<template>
  <div class="mod-config">
    <div>
        <span @click="favoriteFunction()">
         <icon-svg :name="favorite?'xiangqufill':'xiangqu'" class="sl-svg"></icon-svg>
        </span>
    </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.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-select v-model="searchData.projectCategory" 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-select clearable v-model="searchData.cProjectRegion" style="width: 120px">
          <el-option
            v-for = "i in cProjectRegionList"
            :key = "i.cProjectRegion"
            :label = "i.cProjectRegion"
            :value = "i.cProjectRegion">
          </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-button @click="agencyMatter()">查询</el-button>
        <el-button type="primary" @click="addModal()">新增</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
      :height="this.height + 100"
      :data="dataList"
      ref="mainTable"
      highlight-current-row
      @row-click="projectPartClickRow"
      @current-change="changeCurrentRow"
      border
      style="width: 100%;">
      <el-table-column
        v-for="(item,index) in columnList" :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
        fixed="right"
        header-align="center"
        align="center"
        width="208"
        label="操作">
        <template slot-scope="scope">
          <a type="text" size="small" @click="addProjectPartModal(scope.row)">新增产品</a>
          <a v-if="scope.row.status !== '已量产'" type="text" size="small" @click="updateModal(scope.row)">修改</a>
          <a type="text" size="small" @click="eamProjectInfoDelete(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>

    <el-dialog title="项目" :close-on-click-modal="false" @close="closeClear" v-drag :visible.sync="modalFlag" width="600px">
<!--      <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">-->
<!--        <el-form-item label="是否在用" prop="active" :rules="rules.activeType">-->
<!--          <el-select filterable v-model="modalData.active" style="width: 140px">-->
<!--            <el-option label="是" value="Y"></el-option>-->
<!--            <el-option label="否" value="N"></el-option>-->
<!--          </el-select>-->
<!--        </el-form-item>-->
<!--      </el-form>-->
      <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="BU" prop="bu" :rules="rules.bu">
          <el-select v-model="modalData.bu" placeholder="请选择" :disabled="modalDisableFlag" style="width: 110px">
            <el-option
              v-for = "i in userBuList"
              :key = "i.buNo"
              :label = "i.buDesc"
              :value = "i.buNo">
              <span style="float: right; color: #8492a6;white-space:nowrap;overflow:hidden;text-overflow:ellipsis; font-size: 11px;width: 60px">
                {{ i.buDesc }}
              </span>
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="项目编码" prop="projectNo" :rules="rules.projectNo">
          <el-input v-model="modalData.projectNo" :disabled="modalPartDisableFlag" style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="项目名称" prop="projectDesc" v-if="!modalPartDisableFlag" :rules="rules.projectDesc">
          <el-input v-model="modalData.projectDesc" :disabled="modalPartDisableFlag" style="width: 170px"></el-input>
        </el-form-item>
        <el-form-item label="项目名称" prop="projectDesc" v-if="modalPartDisableFlag" :rules="rules.projectDesc">
          <el-input v-model="modalData.projectDesc" :disabled="modalPartDisableFlag" style="width: 294px"></el-input>
        </el-form-item>
        <el-form-item label="区域" prop="cProjectRegion" v-if="!modalPartDisableFlag" :rules="rules.cProjectRegion">
          <el-select v-model="modalData.cProjectRegion" placeholder="请选择" :disabled="modalPartDisableFlag" clearable style="width: 110px">
            <el-option
              v-for = "i in cProjectRegionList"
              :key = "i.cProjectRegion"
              :label = "i.cProjectRegion"
              :value = "i.cProjectRegion">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item prop="customerNo">
          <span slot="label" style="">
            <a herf="#" @click="getBaseList(509)">客户编码</a>
            <a herf="#" @click="newCustomer">（新客户）</a>
          </span>
          <el-input v-model="modalData.customerNo" @blur="customerNoBlur" style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="客户名称" prop="customerDesc">
          <el-input v-model="modalData.customerDesc" disabled style="width: 293px"></el-input>
        </el-form-item>
        <el-form-item label="优先级" prop="priority" :rules="rules.priority">
          <el-select v-model="modalData.priority" placeholder="请选择" clearable style="width: 110px">
            <el-option
              v-for = "i in priorityList"
              :key = "i.priority"
              :label = "i.priority"
              :value = "i.priority">
            </el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <el-form :inline="true" v-if="this.modalData.flag !== '1' && this.modalData.flag !== '2'" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="项目料号" prop="testPartNo" :rules="rules.testPartNo" >
          <el-input v-model="modalData.testPartNo" style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="料号描述" prop="partDesc" :rules="rules.partDesc" >
          <el-input v-model="modalData.partDesc"  style="width: 293px"></el-input>
        </el-form-item>
        <el-form-item label="料号状态" prop="partType" :rules="rules.partType">
          <el-select v-model="modalData.partType"  clearable style="width: 110px">
            <el-option label = "Active" value = "Active"></el-option>
            <el-option label = "On hold" value = "On hold"></el-option>
            <el-option label = "Cancel" value = "Cancel"></el-option>
            <el-option label = "EOL" value = "EOL"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item prop="cQualityEngineer6Name" :rules="rules.cQualityEngineer6Name">
          <span slot="label" style="">
            <a herf="#" @click="getBaseList(2008)">IQC</a>
          </span>
          <el-input v-model="modalData.cQualityEngineer6Name" disabled style="width: 110px"></el-input>
        </el-form-item>
          <el-form-item :label="'立项日期：'">
            <el-date-picker
              style="width: 110px"
              v-model="modalData.projectCreationDate"
              type="date"
              value-format="yyyy-MM-dd"
              placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
          <el-form-item label="项目分类" prop="projectCategory" :rules="rules.projectCategory">
            <el-select v-model="modalData.projectCategory" placeholder="请选择" clearable style="width: 170px">
              <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="'预计完成日期：'" :rules="rules.needDate">
            <el-date-picker
              style="width: 110px"
              v-model="modalData.needDate"
              type="date"
              value-format="yyyy-MM-dd"
              placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
<!--        <el-form-item label="文档类型ID" prop="documentTypeId" :rules="rules.documentTypeIdType">-->
<!--          <el-input v-model="modalData.documentTypeId" style="width: 230px"></el-input>-->
<!--        </el-form-item>-->
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
<!--        <el-form-item prop="projectManager" :rules="rules.projectManager">-->
<!--          <el-input v-model="modalData.projectManager" disabled style="width: 110px"></el-input>-->
<!--        </el-form-item>-->

        <el-form-item label="PM/Sales" prop="projectManagerName" :rules="rules.projectManagerName">
          <span slot="label" style="" @click="projectManagerFlag = true "><a herf="#">PM/Sales</a></span>
          <el-input v-model="modalData.projectManagerName" disabled style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="PjM" prop="projectOwner" :rules="rules.projectOwner">
          <span slot="label" style="" @click="projectOwnerFlag = true"><a herf="#">PjM</a></span>
          <el-input v-model="modalData.projectOwnerName" disabled style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="FQC1" prop="cQualityEngineer3Name" :rules="rules.cQualityEngineer3Name">
          <span slot="label" style="" @click="FQC1Flag = true"><a herf="#">FQC1</a></span>
          <el-input v-model="modalData.cQualityEngineer3Name" disabled style="width: 78px"></el-input>
        </el-form-item>
        <el-form-item prop="cQualityEngineer5Name" :rules="rules.cQualityEngineer5Name">
          <span slot="label" style="">
            <a herf="#" @click="getBaseList(2007)">FQC2</a>
          </span>
          <el-input v-model="modalData.cQualityEngineer5Name" disabled style="width: 78px"></el-input>
        </el-form-item>
<!--        <el-form-item prop="cQualityEngineer2" :rules="rules.cQualityEngineer2">-->
<!--          <el-input v-model="modalData.cQualityEngineer2" disabled style="width: 110px"></el-input>-->
<!--        </el-form-item>-->
        <el-form-item label="IPQC-Lam/Pri/Etch/Slit" prop="cQualityEngineer1Name" :rules="rules.cQualityEngineer1Name">
          <span slot="label" style="" @click="engineerFlag = true"><a herf="#">IPQC-Lam/Pri/Etch/Slit</a></span>
          <el-input v-model="modalData.cQualityEngineer1Name" disabled style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="IPQC-Converting" prop="cQualityEngineer2Name" :rules="rules.cQualityEngineer2Name">
          <span slot="label" style="" @click="IPQCFlag = true"><a herf="#">IPQC-Converting</a></span>
          <el-input v-model="modalData.cQualityEngineer2Name" disabled style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="Engineer" prop="engineerName" :rules="rules.engineerName">
          <span slot="label" style="" @click="engineer6Flag = true"><a herf="#">Engineer</a></span>
          <el-input v-model="modalData.engineerName" disabled style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="MFG" prop="cManufactureEngineerName" :rules="rules.cManufactureEngineerName">
          <span slot="label" style="" @click="MFGlag = true"><a herf="#">MFG</a></span>
          <el-input v-model="modalData.cManufactureEngineerName" disabled style="width: 79px"></el-input>
        </el-form-item>
        <el-form-item prop="cQualityEngineer4Name" :rules="rules.cQualityEngineer4Name">
          <span slot="label" style="">
            <a herf="#" @click="getBaseList(2006)">SQE</a>
          </span>
          <el-input v-model="modalData.cQualityEngineer4Name" disabled style="width: 79px"></el-input>
        </el-form-item>
        <el-form-item label="文档工程师" prop="docEngineerName" :rules="rules.docEngineerName">
          <span slot="label" style="" @click="docEngineerFlag = true"><a herf="#">文档工程师</a></span>
          <el-input v-model="modalData.docEngineerName" disabled style="width: 110px"></el-input>
        </el-form-item>
      </el-form>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button type="primary" @click="saveData()">保存</el-button>
        <el-button @click="modalFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!--新客户客户名称输入弹框-->
    <el-dialog title="新客户" :close-on-click-modal="false" @close="closeNewCustomer" v-drag :visible.sync="newCustomerFlag" width="348px">
      <el-form :inline="true" label-position="top" :model="modalData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="客户名称" prop="customerDesc" :rules="rules.customerDesc">
          <el-input v-model="modalData.customerDesc" style="width: 313px"></el-input>
        </el-form-item>
      </el-form>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button type="primary" @click="saveNewCustomer()">保存</el-button>
        <el-button @click="newCustomerFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!--项目经理选择弹框-->
    <el-dialog title="PM/Sales" @close="closeProjectManagerInfoDialog" @open="openProjectManagerInfoDialog" :visible.sync="projectManagerFlag" width="559px" v-drag>
      <el-form inline="inline" label-position="top" :model="searchBusinessData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="用户账号">
          <el-input v-model="searchBusinessData.username" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="用户名">
          <el-input v-model="searchBusinessData.userDisplay" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="是否在用">
          <el-select filterable v-model="searchBusinessData.active" style="width: 140px">
            <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 type="primary" style="padding: 3px 12px" @click="searchBusinessInfoList()">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table
        :height="height + 110"
        :data="businessDataList"
        stripe
        highlight-current-row
        border
        @row-dblclick="projectManagerRowDblclick"
        style="width: 100%;">
        <el-table-column
          prop="username"
          header-align="center"
          align="center"
          label="用户账号">
        </el-table-column>
        <el-table-column
          prop="userDisplay"
          header-align="center"
          align="center"
          label="用户名">
        </el-table-column>
        <el-table-column
          prop="active"
          header-align="center"
          align="center"
          label="是否在用">
        </el-table-column>
      </el-table>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button @click="projectManagerFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!--PjM选择弹框-->
    <el-dialog title="PjM" @close="closeProjectOwnerInfoDialog" @open="openProjectOwnerInfoDialog" :visible.sync="projectOwnerFlag" width="559px" v-drag>
      <el-form inline="inline" label-position="top" :model="searchBusinessData1" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="用户账号">
          <el-input v-model="searchBusinessData1.username" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="用户名">
          <el-input v-model="searchBusinessData1.userDisplay" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="是否在用">
          <el-select filterable v-model="searchBusinessData1.active" style="width: 140px">
            <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 type="primary" style="padding: 3px 12px" @click="searchBusinessInfoList1()">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table
        :height="height + 110"
        :data="businessDataList1"
        stripe
        highlight-current-row
        border
        @row-dblclick="projectOwnerRowDblclick"
        style="width: 100%;">
        <el-table-column
          prop="username"
          header-align="center"
          align="center"
          label="用户账号">
        </el-table-column>
        <el-table-column
          prop="userDisplay"
          header-align="center"
          align="center"
          label="用户名">
        </el-table-column>
        <el-table-column
          prop="active"
          header-align="center"
          align="center"
          label="是否在用">
        </el-table-column>
      </el-table>
      <el-footer style="height:40px;margin-top:
      10px;text-align:center">
        <el-button @click="projectOwnerFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!--工程师选择弹框-->
    <el-dialog title="Engineer" @close="closeEngineer6InfoDialog" @open="openEngineer6InfoDialog" :visible.sync="engineer6Flag" width="559px" v-drag>
      <el-form inline="inline" label-position="top" :model="searchBusinessData6" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="用户账号">
          <el-input v-model="searchBusinessData6.username" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="用户名">
          <el-input v-model="searchBusinessData6.userDisplay" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="是否在用">
          <el-select filterable v-model="searchBusinessData6.active" style="width: 140px">
            <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 type="primary" style="padding: 3px 12px" @click="searchBusinessInfoList6()">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table
        :height="height + 110"
        :data="businessDataList6"
        stripe
        highlight-current-row
        border
        @row-dblclick="engineer6RowDblclick"
        style="width: 100%;">
        <el-table-column
          prop="username"
          header-align="center"
          align="center"
          label="用户账号">
        </el-table-column>
        <el-table-column
          prop="userDisplay"
          header-align="center"
          align="center"
          label="用户名">
        </el-table-column>
        <el-table-column
          prop="active"
          header-align="center"
          align="center"
          label="是否在用">
        </el-table-column>
      </el-table>
      <el-footer style="height:40px;margin-top:
      10px;text-align:center">
        <el-button @click="engineer6Flag = false">关闭</el-button>
      </el-footer>

    </el-dialog>

    <!--工程师选择弹框-->
    <el-dialog title="IPQC-Lam/Pri/Etch/Slit" @close="closeEngineerInfoDialog" @open="openEngineerInfoDialog" :visible.sync="engineerFlag" width="559px" v-drag>
      <el-form inline="inline" label-position="top" :model="searchBusinessData2" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="用户账号">
          <el-input v-model="searchBusinessData2.username" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="用户名">
          <el-input v-model="searchBusinessData2.userDisplay" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="是否在用">
          <el-select filterable v-model="searchBusinessData2.active" style="width: 140px">
            <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 type="primary" style="padding: 3px 12px" @click="searchBusinessInfoList2()">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table
        :height="height + 110"
        :data="businessDataList2"
        stripe
        highlight-current-row
        border
        @row-dblclick="engineerRowDblclick"
        style="width: 100%;">
        <el-table-column
          prop="username"
          header-align="center"
          align="center"
          label="用户账号">
        </el-table-column>
        <el-table-column
          prop="userDisplay"
          header-align="center"
          align="center"
          label="用户名">
        </el-table-column>
        <el-table-column
          prop="active"
          header-align="center"
          align="center"
          label="是否在用">
        </el-table-column>
      </el-table>
      <el-footer style="height:40px;margin-top:
      10px;text-align:center">
        <el-button @click="engineerFlag = false">关闭</el-button>
      </el-footer>

    </el-dialog>

    <!--IPQC选择弹框-->
    <el-dialog title="IPQC-Converting" @close="closeIPQCInfoDialog" @open="openIPQCInfoDialog" :visible.sync="IPQCFlag" width="559px" v-drag>
      <el-form inline="inline" label-position="top" :model="searchBusinessData3" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="用户账号">
          <el-input v-model="searchBusinessData3.username" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="用户名">
          <el-input v-model="searchBusinessData3.userDisplay" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="是否在用">
          <el-select filterable v-model="searchBusinessData3.active" style="width: 140px">
            <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 type="primary" style="padding: 3px 12px" @click="searchBusinessInfoList3()">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table
        :height="height + 110"
        :data="businessDataList3"
        stripe
        highlight-current-row
        border
        @row-dblclick="IPQCRowDblclick"
        style="width: 100%;">
        <el-table-column
          prop="username"
          header-align="center"
          align="center"
          label="用户账号">
        </el-table-column>
        <el-table-column
          prop="userDisplay"
          header-align="center"
          align="center"
          label="用户名">
        </el-table-column>
        <el-table-column
          prop="active"
          header-align="center"
          align="center"
          label="是否在用">
        </el-table-column>
      </el-table>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button @click="IPQCFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!--FQC1选择弹框-->
    <el-dialog title="FQC1" @close="closeFQC1InfoDialog" @open="openFQC1InfoDialog" :visible.sync="FQC1Flag" width="559px" v-drag>
      <el-form inline="inline" label-position="top" :model="searchBusinessData4" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="用户账号">
          <el-input v-model="searchBusinessData4.username" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="用户名">
          <el-input v-model="searchBusinessData4.userDisplay" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="是否在用">
          <el-select filterable v-model="searchBusinessData4.active" style="width: 140px">
            <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 type="primary" style="padding: 3px 12px" @click="searchBusinessInfoList4()">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table
        :height="height + 110"
        :data="businessDataList4"
        stripe
        highlight-current-row
        border
        @row-dblclick="FQC1RowDblclick"
        style="width: 100%;">
        <el-table-column
          prop="username"
          header-align="center"
          align="center"
          label="用户账号">
        </el-table-column>
        <el-table-column
          prop="userDisplay"
          header-align="center"
          align="center"
          label="用户名">
        </el-table-column>
        <el-table-column
          prop="active"
          header-align="center"
          align="center"
          label="是否在用">
        </el-table-column>
      </el-table>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button @click="FQC1Flag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!--MFG选择弹框-->
    <el-dialog title="MFG" @close="closeMFGInfoDialog" @open="openMFGInfoDialog" :visible.sync="MFGlag" width="559px" v-drag>
      <el-form inline="inline" label-position="top" :model="searchBusinessData5" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="用户账号">
          <el-input v-model="searchBusinessData5.username" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="用户名">
          <el-input v-model="searchBusinessData5.userDisplay" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="是否在用">
          <el-select filterable v-model="searchBusinessData5.active" style="width: 140px">
            <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 type="primary" style="padding: 3px 12px" @click="searchBusinessInfoList5()">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table
        :height="height + 110"
        :data="businessDataList5"
        stripe
        highlight-current-row
        border
        @row-dblclick="MFGRowDblclick"
        style="width: 100%;">
        <el-table-column
          prop="username"
          header-align="center"
          align="center"
          label="用户账号">
        </el-table-column>
        <el-table-column
          prop="userDisplay"
          header-align="center"
          align="center"
          label="用户名">
        </el-table-column>
        <el-table-column
          prop="active"
          header-align="center"
          align="center"
          label="是否在用">
        </el-table-column>
      </el-table>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button @click="MFGlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <!--文档工程师选择弹框-->
    <el-dialog title="文档工程师" @close="closeDocEngineerInfoDialog" @open="openDocEngineerInfoDialog" :visible.sync="docEngineerFlag" width="559px" v-drag>
      <el-form inline="inline" label-position="top" :model="searchBusinessData7" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="用户账号">
          <el-input v-model="searchBusinessData7.username" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="用户名">
          <el-input v-model="searchBusinessData7.userDisplay" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="是否在用">
          <el-select filterable v-model="searchBusinessData7.active" style="width: 140px">
            <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 type="primary" style="padding: 3px 12px" @click="searchBusinessInfoList7()">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table
        :height="height + 110"
        :data="businessDataList7"
        stripe
        highlight-current-row
        border
        @row-dblclick="docEngineerRowDblclick"
        style="width: 100%;">
        <el-table-column
          prop="username"
          header-align="center"
          align="center"
          label="用户账号">
        </el-table-column>
        <el-table-column
          prop="userDisplay"
          header-align="center"
          align="center"
          label="用户名">
        </el-table-column>
        <el-table-column
          prop="active"
          header-align="center"
          align="center"
          label="是否在用">
        </el-table-column>
      </el-table>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button @click="docEngineerFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <el-tabs style="height:100%; margin-top: 0px; width: 100%;"  v-model="activeName" class="customer-tab" type="border-card" @tab-click="tabClick">
      <el-tab-pane label="项目物料" name="projectPart">
        <el-table
            :data="projectPartList"
            border
            style="width: 100%;margin-top: 5px;"
            :height="this.height + 128"
            ref="projectPartTable"
            :row-style="rowStyle"
            v-loading="dataListLoading">
            <el-table-column
              header-align="center"
              align="center"
              width="130"
              fixed="left"
              label="操作">
              <template slot-scope="scope">
                <a type="text" size="small" v-if="scope.row.testPartNo !== 'P000000'" @click="updatePartModal(scope.row)">编辑</a>
                <a type="text" size="small" @click="toMes(scope.row)">详情</a>
                <a type="text" size="small" @click="deletePartModal(scope.row)">删除</a>
              </template>
            </el-table-column>
            <el-table-column
              v-for="(item,index) in columnPartList" :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">
                <div v-if="item.columnProp === 'partType'">
                  <span :style="{ color: scope.row.partType === 'Active' ? 'green' : 'Gray' , fontSize: '14px'}">
                    {{ scope.row[item.columnProp] }}
                  </span>
                </div>
                <div v-else>
                  <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>
                </div>
              </template>
            </el-table-column>
          </el-table>
      </el-tab-pane>
    </el-tabs>

    <Chooselist ref="baseList"  @getBaseData="getBaseData"></Chooselist>

  </div>
</template>

<script>
import {getSiteAndBuByUserName} from "@/api/eam/eam.js"
import {
  searchBusinessInfo,
  searchBusinessInfo1,
  searchBusinessInfo2,
  searchBusinessInfo3,
  searchBusinessInfo4,
  searchBusinessInfo5,
  searchBusinessInfo6
} from "@/api/factory/site.js"
import Chooselist from '@/views/modules/common/Chooselist_eam'
import {removeUserFavorite, saveUserFavorite, userFavoriteList} from '@/api/userFavorite.js'
import {getTableDefaultListLanguage, getTableUserListLanguage,} from "@/api/table.js";
import {
  eamProjectInfoDelete,
  eamProjectInfoEdit,
  eamProjectInfoSave,
  eamProjectInfoSearch,
} from "@/api/eam/eamProject.js";
import {
  eamProjectPartInfoDelete,
  eamProjectPartInfoEdit,
  eamProjectPartInfoSave,
  eamProjectPartSearch, getCustomerNo, queryEamProjectInfo, saveNewCustomer
} from "../../../api/eam/eamProject";
import row from "element-ui/packages/row";
import 'moment/locale/zh-cn';
import {EventBus} from "../../../main";
import {queryCustomerList} from "../../../api/customer/customer";
import {searchBusinessInfo7} from "../../../api/factory/site";
/*打样记录組件*/

  export default {
    computed: {
      row() {
        return row
      },
      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);
      },
    },
    components: {
      Chooselist,
    },
    watch: {
      searchData: {
        deep: true,
        handler: function (newV, oldV) {
          this.searchData.customerNo = this.searchData.customerNo.toUpperCase()
        }
      },
    },
    data () {
      return {
        // 是否收藏
        favorite: false,
        // 导出 start
        exportData: [],
        exportName: "项目信息" + this.dayjs().format('YYYYMMDDHHmmss'),
        exportHeader: ["项目信息"],
        exportFooter: [],
        exportList:[],
        // 导出 end
        tagNo:'',
        fileName:'',
        folder: 'projectConfirm',
        searchData: {
          site: this.$store.state.user.site,
          userName: this.$store.state.user.name,
          projectId: '',
          projectNo: '',
          projectDesc: '',
          partDesc: '',
          customerNo: '',
          customerDesc: '',
          buDesc: '',
          projectCategory: '',
          status: '',
          projectManager: '',
          projectOwner: '',
          engineer: '',
          startDate:'',
          endDate:'',
          projectCreationDate: new Date(),
          projectCloseDate:'',
          needDate:'',
          cProjectRegion: '',
          // active: 'Y',
          page: 1,
          limit: 10,
        },
        height: 200,
        pageIndex: 1,
        pageSize: 20,
        totalPage: 0,
        businessDataList: [],
        businessDataList1: [],
        businessDataList2: [],
        businessDataList3: [],
        businessDataList4: [],
        businessDataList5: [],
        businessDataList6: [],
        businessDataList7: [],
        dataList: [],
        selectTypeFlag: [],
        projectPartList: [],
        allPersonnelInfoList: [],
        // ======== 选中的当前行数据 ========
        projectPart: {},
        fileList: [],
        dataListLoading: false,
        modalFlag:false,
        modalDisableFlag:false,
        modalPartDisableFlag:false,
        projectManagerFlag:false,
        projectOwnerFlag:false,
        engineerFlag:false,
        engineer6Flag:false,
        IPQCFlag:false,
        FQC1Flag:false,
        MFGlag:false,
        docEngineerFlag:false,
        newCustomerFlag:false,
        modalData:{
          flag:'',
          bu: '',
          buNo: '',
          buDesc: '',
          site: this.$store.state.user.site,
          projectId: '',
          projectNo: '',
          projectPartId: '',
          oriProjectId: '',
          projectDesc:'',
          projectCloseDate:'',
          proofingNo:'',
          needDate:'',
          customerNo:'',
          finalCustomerId:'',
          customerDesc:'',
          projectCategory:'',
          testPartNo:'',
          partDesc:'',
          priority:'',
          projectManager:'',
          projectManagerName:'',
          projectOwner:'',
          projectOwnerName:'',
          cProjectRegion:'',
          cProjectBuildDate:'',
          cQualityEngineer1:'',
          cQualityEngineer1Name:'',
          cQualityEngineer2:'',
          cQualityEngineer2Name:'',
          cQualityEngineer3:'',
          cQualityEngineer3Name:'',
          cQualityEngineer4:'',
          cQualityEngineer4Name:'',
          cQualityEngineer5:'',
          cQualityEngineer5Name:'',
          cQualityEngineer6:'',
          cQualityEngineer6Name:'',
          cManufactureEngineer:'',
          cManufactureEngineerName:'',
          docEngineer:'',
          docEngineerName:'',
          engineer:'',
          engineerName:'',
          //projectCreationDate为当前服务器的时间
          projectCreationDate: new Date(),
          finalPartNo:'',
          finalPartDesc:'',
          partType:'',
          wantedConfirmDate: new Date(),
          // active:'',
          createBy: this.$store.state.user.name,
          updateBy: this.$store.state.user.name,
        },
        searchBusinessData:{
          site: this.$store.state.user.site,
          username: '',
          roleDesc: '',
          userDisplay: '',
          active: '',
          page: 1,
          limit: 10,
        },
        searchBusinessData1:{
          site: this.$store.state.user.site,
          username: '',
          roleDesc: '',
          userDisplay: '',
          active: '',
          page: 1,
          limit: 10,
        },
        searchBusinessData2:{
          site: this.$store.state.user.site,
          username: '',
          roleDesc: '',
          userDisplay: '',
          active: '',
          page: 1,
          limit: 10,
        },
        searchBusinessData3:{
          site: this.$store.state.user.site,
          username: '',
          roleDesc: '',
          userDisplay: '',
          active: '',
          page: 1,
          limit: 10,
        },
        searchBusinessData4:{
          site: this.$store.state.user.site,
          username: '',
          roleDesc: '',
          userDisplay: '',
          active: '',
          page: 1,
          limit: 10,
        },
        searchBusinessData5:{
          site: this.$store.state.user.site,
          username: '',
          roleDesc: '',
          userDisplay: '',
          active: '',
          page: 1,
          limit: 10,
        },
        searchBusinessData6:{
          site: this.$store.state.user.site,
          username: '',
          roleDesc: '',
          userDisplay: '',
          active: '',
          page: 1,
          limit: 10,
        },
        searchBusinessData7:{
          site: this.$store.state.user.site,
          username: '',
          roleDesc: '',
          userDisplay: '',
          active: '',
          page: 1,
          limit: 10,
        },
        activeName: 'projectPart',
        // 展示列集
        columnList: [
          {
            userId: this.$store.state.user.name,
            functionId: 401003,
            serialNumber: '401003Table1BuDesc',
            tableId: "401003Table1",
            tableName: "BU文档清单表",
            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: 401003,
            serialNumber: '401003Table1ProjectId',
            tableId: "401003Table1",
            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: 401003,
            serialNumber: '401003Table1ProjectDesc',
            tableId: "401003Table1",
            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: 401003,
            serialNumber: '401003Table1customerNo',
            tableId: "401003Table1",
            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: 401003,
            serialNumber: '401003Table1customerDesc',
            tableId: "401003Table1",
            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: 401003,
            serialNumber: '401003Table1ProjectCreationDate',
            tableId: "401003Table1",
            tableName: "项目信息表",
            columnProp: "projectCreationDate",
            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: 401003,
            serialNumber: '401003Table1ProjectCategory',
            tableId: "401003Table1",
            tableName: "项目信息表",
            columnProp: 'projectCategory',
            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: 401003,
            serialNumber: '401003Table1Priority',
            tableId: "401003Table1",
            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: 401003,
            serialNumber: '401003Table1CProjectRegion',
            tableId: "401003Table1",
            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: 401003,
            serialNumber: '401003Table1ProjectManager',
            tableId: "401003Table1",
            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: 401003,
            serialNumber: '401003Table1ProjectOwner',
            tableId: "401003Table1",
            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: 401003,
            serialNumber: '401003Table1Engineer',
            tableId: "401003Table1",
            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: 401003,
            serialNumber: '401003Table1CQualityEngineer1',
            tableId: "401003Table1",
            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: 120,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 401003,
            serialNumber: '401003Table1CQualityEngineer2',
            tableId: "401003Table1",
            tableName: "项目信息表",
            columnProp: 'cQualityEngineer2Name',
            headerAlign: "center",
            align: "left",
            columnLabel: 'IPQC-Converting',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 401003,
            serialNumber: '401003Table1CQualityEngineer3',
            tableId: "401003Table1",
            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: 401003,
            serialNumber: '401003Table1CQualityEngineer5',
            tableId: "401003Table1",
            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: 401003,
            serialNumber: '401003Table1CQualityEngineer6',
            tableId: "401003Table1",
            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: 401003,
            serialNumber: '401003Table1CManufactureEngineer',
            tableId: "401003Table1",
            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: 401003,
            serialNumber: '401003Table1CQualityEngineer4',
            tableId: "401003Table1",
            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: 401003,
            serialNumber: '401003Table1DocEngineer',
            tableId: "401003Table1",
            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: 401003,
            serialNumber: '401003Table1Status',
            tableId: "401003Table1",
            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: 401003,
            serialNumber: '401003Table1NeedDate',
            tableId: "401003Table1",
            tableName: "项目信息表",
            columnProp: 'needDate',
            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: 401003,
            serialNumber: '401003Table1ProjectCloseDate',
            tableId: "401003Table1",
            tableName: "项目信息表",
            columnProp: 'projectCloseDate',
            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: 401003,
            serialNumber: '401003Table1CreateDate',
            tableId: "401003Table1",
            tableName: "项目信息表",
            columnProp: 'createDate',
            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: 401003,
            serialNumber: '401003Table1CreateBy',
            tableId: "401003Table1",
            tableName: "项目信息表",
            columnProp: 'createBy',
            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: 401003,
            serialNumber: '401003Table1UpdateDate',
            tableId: "401003Table1",
            tableName: "项目信息表",
            columnProp: 'updateDate',
            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: 401003,
            serialNumber: '401003Table1UpdateBy',
            tableId: "401003Table1",
            tableName: "项目信息表",
            columnProp: 'updateBy',
            headerAlign: "center",
            align: "left",
            columnLabel: '更新人',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120,
          },
        ],
        columnPartList: [
          {
            userId: this.$store.state.user.name,
            functionId: 401003,
            serialNumber: '401003Table2TestPartNo',
            tableId: "401003Table2",
            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: 401003,
            serialNumber: '401003Table2PartDesc',
            tableId: "401003Table2",
            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: 401003,
            serialNumber: '401003Table2BuildDate',
            tableId: "401003Table2",
            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: 401003,
            serialNumber: '401003Table2ProjectCategory',
            tableId: "401003Table2",
            tableName: "项目信息物料表",
            columnProp: 'projectCategory',
            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: 401003,
            serialNumber: '401003Table2Priority',
            tableId: "401003Table2",
            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: 401003,
            serialNumber: '401003Table2ProjectManager',
            tableId: "401003Table2",
            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: 401003,
            serialNumber: '401003Table2ProjectOwner',
            tableId: "401003Table2",
            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: 401003,
            serialNumber: '401003Table2Engineer',
            tableId: "401003Table2",
            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: 401003,
            serialNumber: '401003Table2CQualityEngineer1',
            tableId: "401003Table2",
            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: 120,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 401003,
            serialNumber: '401003Table2CQualityEngineer2',
            tableId: "401003Table2",
            tableName: "项目信息物料表",
            columnProp: 'cQualityEngineer2Name',
            headerAlign: "center",
            align: "left",
            columnLabel: 'IPQC-Converting',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 401003,
            serialNumber: '401003Table2CQualityEngineer3',
            tableId: "401003Table2",
            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: 401003,
            serialNumber: '401003Table2CQualityEngineer5',
            tableId: "401003Table2",
            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: 401003,
            serialNumber: '401003Table2CQualityEngineer6',
            tableId: "401003Table2",
            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: 401003,
            serialNumber: '401003Table2CManufactureEngineer',
            tableId: "401003Table2",
            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: 401003,
            serialNumber: '401003Table2CQualityEngineer4',
            tableId: "401003Table2",
            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: 401003,
            serialNumber: '401003Table2DocEngineer',
            tableId: "401003Table2",
            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: 401003,
            serialNumber: '401003Table2Status',
            tableId: "401003Table2",
            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: 401003,
            serialNumber: '401003Table2PartType',
            tableId: "401003Table2",
            tableName: "项目信息物料表",
            columnProp: 'partType',
            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: 401003,
            serialNumber: '401003Table2NeedDate',
            tableId: "401003Table2",
            tableName: "项目信息物料表",
            columnProp: 'needDate',
            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: 401003,
            serialNumber: '401003Table2CloseDate',
            tableId: "401003Table2",
            tableName: "项目信息物料表",
            columnProp: 'closeDate',
            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: 401003,
            serialNumber: '401003Table2FinalPartNo',
            tableId: "401003Table2",
            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: 401003,
            serialNumber: '401003Table2CreateDate',
            tableId: "401003Table2",
            tableName: "项目信息物料表",
            columnProp: 'createDate',
            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: 401003,
            serialNumber: '401003Table2CreateBy',
            tableId: "401003Table2",
            tableName: "项目信息物料表",
            columnProp: 'createBy',
            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: 401003,
            serialNumber: '401003Table2UpdateDate',
            tableId: "401003Table2",
            tableName: "项目信息物料表",
            columnProp: 'updateDate',
            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: 401003,
            serialNumber: '401003Table2UpdateBy',
            tableId: "401003Table2",
            tableName: "项目信息物料表",
            columnProp: 'updateBy',
            headerAlign: "center",
            align: "left",
            columnLabel: '更新人',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120,
          },
        ],
        rules:{
          projectNo:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          projectDesc:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          testPartNo:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          partDesc:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          partType:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          projectManager:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          engineer:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          projectOwner:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cProjectRegion:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cQualityEngineer1:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cQualityEngineer2:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cQualityEngineer3:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cQualityEngineer4:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cQualityEngineer4Name:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cQualityEngineer5:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cQualityEngineer5Name:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cQualityEngineer6:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cQualityEngineer6Name:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cManufactureEngineer:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          docEngineer:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          docEngineerName:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          projectManagerName:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          engineerName:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cQualityEngineer1Name:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cQualityEngineer2Name:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cQualityEngineer3Name:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cManufactureEngineerName:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          projectCategoryType:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          documentTypeIdType:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          documentTypeType:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          responsibleDepartmentType:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          estimatedCompletionDaysType:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          activeType:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          bu:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          finalPartNo:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          finalPartDesc:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          needDate:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          projectCreationDate:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          wantedConfirmDate:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
        },
        projectCategoryList: [
          {
            projectCategory: 'Low Risk',
          },
          {
            projectCategory: 'High Risk',
          },
          {
            projectCategory: 'Sustaining',
          }
        ],
        cProjectRegionList: [
          {
            cProjectRegion: 'Global',
          },
          {
            cProjectRegion: 'APAC',
          },
          {
            cProjectRegion: 'CHINA',
          },
          {
            cProjectRegion: 'EU',
          },
          {
            cProjectRegion: 'US',
          },
          {
            cProjectRegion: 'Mexico',
          },
          {
            cProjectRegion: 'Other',
          },
        ],
        priorityList: [
          {
            priority: 'Low',
          },
          {
            priority: 'Middle',
          },
          {
            priority: 'High',
          },
        ],
        statusList: [
          {
            status: '草稿',
          },
          {
            status: '进行中',
          },
          {
            status: '已量产',
          }
        ],
        userBuList: [],
        menuId: this.$route.meta.menuId,
      }
    },

    mounted () {
      this.$nextTick(() => {
        this.height = window.innerHeight - 558
      })
      EventBus.$on('updateProjectInfo', () => {
        this.getDataList();
      });

    },

    activated() {
      this.$store.commit("sift/commitSearchFunction",this.queryDataList)
    },

    created () {
      // 按钮控制
      this.getButtonAuthData()
      // 获取用户的 site 和 bu
      this.getSiteAndBuByUserName()
      // 校验用户是否收藏
      this.favoriteIsOk()
      // 动态列
      this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
      this.getTableUserColumn(this.$route.meta.menuId+'table2',2)
      if (!this.authSearch) {
        if (!this.agencyMatters){
          // 获取数据列表
          this.getDataList()
        }
      }
    },

    methods: {
      // 获取用户的bu
      getSiteAndBuByUserName () {
        let tempData = {
          username: this.$store.state.user.name,
        }
        getSiteAndBuByUserName(tempData).then(({data}) => {
          if (data.code === 0) {
            this.userBuList = data.rows
          }
        })
      },

      // 获取基础数据列表S
      getBaseList (val,type) {
        this.tagNo = val
        this.$nextTick(() => {
          let strVal = ''
          let conSql = ''
          if (val === 509 ) {
            strVal = this.modalData.customerNo ? this.modalData.customerNo : ''
          }
          if (val === 2006 ) {
            conSql = " and b.site = '" + this.$store.state.user.site + "'"
          }
          if (val === 2007 ) {
            conSql = " and b.site = '" + this.$store.state.user.site + "'"
          }
          if (val === 2008 ) {
            conSql = " and b.site = '" + this.$store.state.user.site + "'"
          }
          this.$refs.baseList.init(val, strVal,conSql)
        })
      },

      /* 列表方法的回调 */
      getBaseData (val) {
        if (this.tagNo === 509) {
          this.modalData.customerNo = val.customer_no
          this.modalData.customerDesc = val.customer_desc
        }
        if (this.tagNo === 2006) {
          this.modalData.cQualityEngineer4 = val.username + '-' + val.user_display
          this.modalData.cQualityEngineer4Name = this.modalData.cQualityEngineer4.split('-')[1]
          searchBusinessInfo7(this.searchBusinessData7).then(({data}) => {
            if (data && data.code === 0){
              this.businessDataList7 = data.rows;
            }
          })
        }
        if (this.tagNo === 2007) {
          this.modalData.cQualityEngineer5 = val.username + '-' + val.user_display
          this.modalData.cQualityEngineer5Name = this.modalData.cQualityEngineer5.split('-')[1]
          searchBusinessInfo7(this.searchBusinessData7).then(({data}) => {
            if (data && data.code === 0){
              this.businessDataList7 = data.rows;
            }
          })
        }
        if (this.tagNo === 2008) {
          this.modalData.cQualityEngineer6 = val.username + '-' + val.user_display
          this.modalData.cQualityEngineer6Name = this.modalData.cQualityEngineer6.split('-')[1]
          searchBusinessInfo7(this.searchBusinessData7).then(({data}) => {
            if (data && data.code === 0){
              this.businessDataList7 = data.rows;
            }
          })
        }
      },

      newCustomer () {
        this.modalData.customerNo = ''
        this.modalData.customerDesc = ''
        this.newCustomerFlag = true
      },

      customerNoBlur(){
        let params = {
          customerNo: this.modalData.customerNo,
          createBy: this.$store.state.user.name,
        }
        queryCustomerList(params).then(({data}) => {
          if (data && data.code === 0) {
            if (data.rows.length === 1){
              this.modalData.customerDesc = data.rows[0].customerDesc
            }else {
              this.modalData.customerDesc = ''
            }
          }else {
            this.$message.warning(data.message)
          }
        }).catch((error) => {
          this.$message.error(error)
        })
      },

      saveNewCustomer () {
        this.generateNextCustomerNo().then((customerNo) => {
          if (customerNo !== false) {
            this.modalData.customerNo = customerNo
            let tempData = {
              site: this.$store.state.user.site,
              customerNo: customerNo,
              customerDesc: this.modalData.customerDesc,
              createBy: this.$store.state.user.name,
            }
            saveNewCustomer(tempData).then(({data}) => {
              if (data.code === 0) {
                this.modalData.customerNo = ''
                this.modalData.customerDesc = ''
                this.$message.success(data.msg)
                this.newCustomerFlag = false
              }
            })
          }
          else {
            this.$alert('该客户已存在，请重新输入客户名称!', '提示', {
              confirmButtonText: '确定',
              type: 'warning'
            })
          }
        })

      },

      generateNextCustomerNo() {
        return new Promise((resolve, reject) => {

          getCustomerNo(this.modalData).then(({ data }) => {
            if (data.code === 0){
              if (data.data === null || data.data === undefined || data.data === '' || data.data === '0') {
                resolve('C0001');
              } else {
                const stringData = String(data.data.customerNo); // 显式转换为字符串
                const lastCustomerNo = parseInt(stringData.substring(1));
                const nextCustomerNo = lastCustomerNo + 1;
                let customerNo;

                if (nextCustomerNo < 10) {
                  customerNo = 'C000' + nextCustomerNo;
                } else if (nextCustomerNo < 100) {
                  customerNo = 'C00' + nextCustomerNo;
                } else if (nextCustomerNo < 1000) {
                  customerNo = 'C0' + nextCustomerNo;
                } else {
                  customerNo = 'C' + nextCustomerNo;
                }
                resolve(customerNo);
              }
            }
            else {
              resolve(false);
            }
          }).catch(error => {
            reject('Failed to fetch customerNo: ' + error);
          });
        });
      },

      closeNewCustomer () {
        this.modalData.customerNo = ''
        this.modalData.customerDesc = ''
        this.newCustomerFlag = false
      },

      // 校验用户是否收藏
      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
          })
        }
      },

      //导出excel
      async createExportData () {
        this.searchData.limit = -1
        this.searchData.page = 1
        await eamProjectInfoSearch(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.docEngineer !== null && item.docEngineer !== '') {
              item.docEngineerName = item.docEngineer.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];
            }
          });

          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 === '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 === '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 === '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];
              }
            }
          }
        })
        return this.exportList
      },

      startDownload () {},

      finishDownload () {},

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

      agencyMatter(){
        this.agencyMatters = false
        this.projectPartCurrentRow = null
        this.getDataList()
      },

      // 获取数据列表
      getDataList (params) {
        this.selectTypeFlag = params
          this.searchData.limit = this.pageSize
          this.searchData.page = this.pageIndex
          eamProjectInfoSearch(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
              // 遍历dataList
              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]
                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]
                }
                item.cManufactureEngineerName = item.cManufactureEngineer.split('-')[1]
                if (item.docEngineer != null && item.docEngineer !== ''){
                  item.docEngineerName = item.docEngineer.split('-')[1]
                }
              })

              // 获取全部人员信息用于下拉框
              this.getAllPersonnelList()

              // 判断是否全部存在数据
              if (this.totalPage > 0) {
                if (this.projectPartCurrentRow === null || this.projectPartCurrentRow === undefined) {
                  // 设置选中行
                  this.$refs.mainTable.setCurrentRow(this.dataList[0])
                  // 加载当前的页签的table
                  this.refreshCurrentTabTable()
                } else {
                  let index = this.dataList.findIndex(item => item.projectId === this.projectPartCurrentRow.projectId)
                  // 设置选中行
                  this.$refs.mainTable.setCurrentRow(this.dataList[index])
                  // 加载当前的页签的table
                  this.refreshCurrentTabTable()
                }
              }
            } else {
              this.$alert(data.msg, '提示', {
                confirmButtonText: '确定',
                type: 'warning'
              })
            }
          })
        },

      queryDataList (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
        }
        queryEamProjectInfo(params).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
            // 遍历dataList
            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]
              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]
              }
              item.cManufactureEngineerName = item.cManufactureEngineer.split('-')[1]
              if (item.docEngineer != null && item.docEngineer !== ''){
                item.docEngineerName = item.docEngineer.split('-')[1]
              }
            })

            // 获取全部人员信息用于下拉框
            this.getAllPersonnelList()

            // 判断是否全部存在数据
            if (this.totalPage > 0) {
              // 设置选中行
              this.$refs.mainTable.setCurrentRow(this.dataList[0])
              // 加载当前的页签的table
              this.refreshCurrentTabTable()
            }
          } else {
            this.$alert(data.msg, '提示', {
              confirmButtonText: '确定',
              type: 'warning'
            })
          }
        })
      },

      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;
        },

      // ======== 列表操作方法 ========
      /**
       * 单机选中项目信息
       * @param row
       */
      projectPartClickRow(row){
        this.projectPartCurrentRow=JSON.parse(JSON.stringify(row));
      },
      /**
       * 当前值发生变化的时候修改
       * @param row
       * @param oldRow
       */
      changeCurrentRow (row, oldRow) {
        // 判断是否是获取焦点的事件
        if (row) {
          this.projectPartCurrentRow = JSON.parse(JSON.stringify(row))
          //刷新当前页表
          this.refreshCurrentTabTable()
        }
      },
      // 每页数
      sizeChangeHandle (val) {
        this.pageSize = val
        this.pageIndex = 1
        if (this.selectTypeFlag !== null && this.selectTypeFlag !== undefined) {
          this.queryDataList(this.selectTypeFlag)
        } else {
          this.getDataList()
        }
      },
      // 当前页
      currentChangeHandle (val) {
        this.pageIndex = val
        if (this.selectTypeFlag !== null && this.selectTypeFlag !== undefined) {
          this.queryDataList(this.selectTypeFlag)
        } else {
          this.getDataList()
        }
      },

      addModal () {
        this.modalData = {
          flag: '1',
          bu: this.userBuList[0].buNo,
          site: this.$store.state.user.site,
          customerNo:'',
          customerDesc:'',
          projectCategory:'',
          testPartNo:'',
          partDesc:'',
          projectNo: '',
          projectDesc:'',
          projectCloseDate:'',
          needDate:'',
          cProjectRegion: '',
          projectManager:'',
          projectOwner:'',
          projectOwnerName:'',
          projectManagerName:'',
          engineer: '',
          engineerName: '',
          cQualityEngineer1:'',
          cQualityEngineer1Name:'',
          cQualityEngineer2:'',
          cQualityEngineer2Name:'',
          cQualityEngineer3:'',
          cQualityEngineer3Name:'',
          cQualityEngineer4:'',
          cQualityEngineer4Name:'',
          cQualityEngineer5:'',
          cQualityEngineer5Name:'',
          cQualityEngineer6:'',
          cQualityEngineer6Name:'',
          cManufactureEngineer: '',
          cManufactureEngineerName: '',
          docEngineer: '',
          docEngineerName: '',
          projectCreationDate:new Date(),
          createDate: '',
          // active: 'Y',
          createBy: this.$store.state.user.name,
          updateBy: this.$store.state.user.name,
        }
        this.modalDisableFlag = false
        this.modalPartDisableFlag = false
        this.modalFlag = true
      },
      updateModal (row) {
        this.modalData = {
          flag: '2',
          site: row.site,
          bu: row.site + '_' + row.buNo,
          customerNo: row.customerNo,
          customerDesc: row.customerDesc,
          projectCategory: row.projectCategory,
          testPartNo: row.testPartNo,
          partDesc: row.partDesc,
          projectId: row.projectId,
          projectNo: row.projectNo,
          projectDesc: row.projectDesc,
          priority: row.priority,
          projectCloseDate: row.projectCloseDate,
          needDate: row.needDate,
          cProjectRegion: row.cProjectRegion,
          projectManager: row.projectManager,
          projectManagerName: row.projectManager.split('-')[1], // 截取用户名
          projectOwner: row.projectOwner,
          projectOwnerName: row.projectOwner.split('-')[1], // 截取用户名
          engineer: row.engineer,
          engineerName: row.engineer.split('-')[1], // 截取用户名
          cQualityEngineer1: row.cQualityEngineer1,
          cQualityEngineer1Name: row.cQualityEngineer1.split('-')[1], // 截取用户名
          cQualityEngineer2: row.cQualityEngineer2,
          cQualityEngineer2Name: row.cQualityEngineer2.split('-')[1], // 截取用户名
          cQualityEngineer3: row.cQualityEngineer3,
          cQualityEngineer3Name: row.cQualityEngineer3.split('-')[1], // 截取用户名
          cQualityEngineer4: row.cQualityEngineer4,
          cQualityEngineer5: row.cQualityEngineer5,
          cQualityEngineer6: row.cQualityEngineer6,
          cManufactureEngineer: row.cManufactureEngineer,
          cManufactureEngineerName: row.cManufactureEngineer.split('-')[1], // 截取用户名
          docEngineer: row.docEngineer,
          projectCreationDate: row.projectCreationDate,
          status: row.status,
          // active: row.active,
          createBy: this.$store.state.user.name,
          updateBy: this.$store.state.user.name,
        }
        if (row.cQualityEngineer4 != null && row.cQualityEngineer4 !== ''){
          this.modalData.cQualityEngineer4Name= row.cQualityEngineer4.split('-')[1] // 截取用户名
        }
        if (row.cQualityEngineer5 != null && row.cQualityEngineer5 !== ''){
          this.modalData.cQualityEngineer5Name= row.cQualityEngineer5.split('-')[1] // 截取用户名
        }
        if (row.cQualityEngineer6 != null && row.cQualityEngineer6 !== ''){
          this.modalData.cQualityEngineer6Name= row.cQualityEngineer6.split('-')[1] // 截取用户名
        }
        if (row.docEngineer != null && row.docEngineer !== ''){
          this.modalData.docEngineerName= row.docEngineer.split('-')[1] // 截取用户名
        }
        this.modalDisableFlag = true
        this.modalPartDisableFlag = false
        this.modalFlag = true
      },
      // 删除
      eamProjectInfoDelete (row) {
        this.$confirm(`是否删除这个项目信息?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          eamProjectInfoDelete(row).then(({data}) => {
            if (data && data.code === '0') {
              this.getDataList()
              EventBus.$emit('updateProjectPartInfo')
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        }).catch(() => {
        })
      },
      saveData () {
        this.modalData.oriProjectId = this.modalData.projectNo
        this.modalData.finalCustomerId = this.modalData.customerNo
        if (this.modalData.projectNo === '' || this.modalData.projectNo == null) {
          this.$message.warning('请输入项目编码！')
          return
        }
        if (this.modalData.projectDesc === '' || this.modalData.projectDesc == null) {
          this.$message.warning('请输入项目名称！')
          return
        }
        if (this.modalData.customerNo === '' || this.modalData.customerNo == null) {
          this.modalData.customerNo = 'C0000'
          this.modalData.customerDesc = '无客户'
          this.modalData.finalCustomerId = this.modalData.customerNo
        }
        if (this.modalData.customerDesc === '' || this.modalData.customerDesc == null) {
            this.$alert('该客户不存在，请重新输入客户编码或点击新客户添加客户!', '提示', {
              confirmButtonText: '确定',
              type: 'warning'
            })
          return;
        }
        //请选择立项日期
        if (this.searchData.projectCreationDate == null) {
          this.$message.warning('请选择立项日期！')
          return
        }
        if (this.modalData.needDate === '' || this.modalData.needDate == null) {
          this.$message.warning('请选择预计完成日期！')
          return
        }
        if (this.modalData.projectCategory === '' || this.modalData.projectCategory == null) {
          this.$message.warning('请选择项目分类！')
          return
        }
        if (this.modalData.bu === '' || this.modalData.bu == null) {
          this.$message.warning('请选择BU！')
          return
        }
        if (this.modalData.projectManager === '' || this.modalData.projectManager == null) {
          this.$message.warning('请输入PM/Sales！')
          return
        }if (this.modalData.projectOwner === '' || this.modalData.projectOwner == null) {
          this.$message.warning('请输入PjM！')
          return
        }
        if (this.modalData.engineer === '' || this.modalData.engineer == null) {
          this.$message.warning('请输入Engineer！')
          return
        }
        if (this.modalData.cQualityEngineer1 === '' || this.modalData.cQualityEngineer1 == null) {
          this.$message.warning('请输入IPQC-Lam/Pri/Etch/Slit！')
          return
        }
        if (this.modalData.cQualityEngineer2 === '' || this.modalData.cQualityEngineer2 == null) {
          this.$message.warning('请输入IPQC-Converting！')
          return
        }
        if (this.modalData.cQualityEngineer3 === '' || this.modalData.cQualityEngineer3 == null) {
          this.$message.warning('请输入FQC1！')
          return
        }
        if (this.modalData.cQualityEngineer5 === '' || this.modalData.cQualityEngineer5 == null) {
          this.$message.warning('请输入FQC2！')
          return
        }
        if (this.modalData.cQualityEngineer6 === '' || this.modalData.cQualityEngineer6 == null) {
          this.$message.warning('请输入IQC！')
          return
        }
        if (this.modalData.cQualityEngineer4 === '' || this.modalData.cQualityEngineer4 == null) {
          this.$message.warning('请输入SQE！')
          return
        }
        if (this.modalData.cManufactureEngineer === '' || this.modalData.cManufactureEngineer == null) {
          this.$message.warning('请输入MFG！')
          return
        }
        if (this.modalData.docEngineer === '' || this.modalData.docEngineer == null) {
          this.$message.warning('请输入文档工程师！')
          return
        }
        // if (this.modalData.active === '' || this.modalData.active == null) {
        //   this.$message.warning('选择是否在用！')
        //   return
        // }
        if (this.modalData.flag === '1') {
          // 遍历userBuList
          this.userBuList.forEach((item) => {
            if (this.modalData.bu === item.buNo) {
              this.modalData.buDesc = item.buDesc
            }
          })
          this.$confirm('项目 ' + this.modalData.projectNo + '-' + this.modalData.projectDesc + ' 的BU为：' + this.modalData.buDesc + '，是否确认继续保存？', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            if (new Date(this.modalData.needDate).getTime() < new Date().getTime()) {
              this.$confirm('预计完成日期小于当前日期，确定继续保存？', '提示', {
                confirmButtonText: '确定',
                cancelButtonText: '取消',
                type: 'warning'
              }).then(() => {
                this.modalData.status = '草稿'
                let inData = {
                  projectId: null,
                  projectNo: this.modalData.projectNo,
                  projectDesc: this.modalData.projectDesc,
                  projectCategory: this.modalData.projectCategory,
                  projectCloseDate: this.modalData.projectCloseDate,
                  needDate: this.modalData.needDate,
                  cProjectRegion: this.modalData.cProjectRegion,
                  projectManager: this.modalData.projectManager,
                  projectOwner: this.modalData.projectOwner,
                  engineer: this.modalData.engineer,
                  cQualityEngineer1: this.modalData.cQualityEngineer1,
                  cQualityEngineer2: this.modalData.cQualityEngineer2,
                  cQualityEngineer3: this.modalData.cQualityEngineer3,
                  cQualityEngineer4: this.modalData.cQualityEngineer4,
                  cQualityEngineer5: this.modalData.cQualityEngineer5,
                  cQualityEngineer6: this.modalData.cQualityEngineer6,
                  cManufactureEngineer: this.modalData.cManufactureEngineer,
                  docEngineer: this.modalData.docEngineer,
                  projectCreationDate: this.modalData.projectCreationDate,
                  createDate: this.modalData.createDate,
                  createBy: this.modalData.createBy,
                  updateBy: this.modalData.updateBy,
                  site: this.modalData.site,
                  bu: this.modalData.bu,
                  customerNo: this.modalData.customerNo,
                  customerDesc: this.modalData.customerDesc,
                  status: this.modalData.status,
                  active: this.modalData.active,
                  closeDate: this.modalData.projectCloseDate,
                  buildDate: this.modalData.projectCreationDate,
                  priority: this.modalData.priority,
                  testPartNo: 'P000000',
                  partDesc: '无物料',
                  partType: 'Active',
                }
                eamProjectInfoSave(this.modalData).then(({data}) => {
                  if (data && data.code === '0') {
                    eamProjectInfoSearch(this.searchData).then(({data}) => {
                      if (data && data.code === 0) {
                        inData.projectId = data.page.list[0].projectId
                        eamProjectPartInfoSave(inData).then(({data}) => {
                          if (data && data.code === 0) {
                            this.getDataList()
                            this.modalFlag = false
                            EventBus.$emit('updateProjectPartInfo')
                            this.$message({
                              message: '操作成功',
                              type: 'success',
                              duration: 1500,
                              onClose: () => {
                              },
                            })
                          } else {
                            this.$alert(data.msg, '错误', {
                              confirmButtonText: '确定'
                            })
                          }
                        })
                      }
                    })
                  }
                })
              }).catch(() => {
                // 如果点击取消提示已取消操作
                this.$message({
                  type: 'info',
                  message: '已取消操作'
                })
              })
            } else {
              this.modalData.status = '草稿'
              let inData = {
                projectId: null,
                projectNo: this.modalData.projectNo,
                projectDesc: this.modalData.projectDesc,
                projectCategory: this.modalData.projectCategory,
                projectCloseDate: this.modalData.projectCloseDate,
                needDate: this.modalData.needDate,
                cProjectRegion: this.modalData.cProjectRegion,
                projectManager: this.modalData.projectManager,
                projectOwner: this.modalData.projectOwner,
                engineer: this.modalData.engineer,
                cQualityEngineer1: this.modalData.cQualityEngineer1,
                cQualityEngineer2: this.modalData.cQualityEngineer2,
                cQualityEngineer3: this.modalData.cQualityEngineer3,
                cQualityEngineer4: this.modalData.cQualityEngineer4,
                cQualityEngineer5: this.modalData.cQualityEngineer5,
                cQualityEngineer6: this.modalData.cQualityEngineer6,
                cManufactureEngineer: this.modalData.cManufactureEngineer,
                docEngineer: this.modalData.docEngineer,
                projectCreationDate: this.modalData.projectCreationDate,
                createDate: this.modalData.createDate,
                createBy: this.modalData.createBy,
                updateBy: this.modalData.updateBy,
                site: this.modalData.site,
                bu: this.modalData.bu,
                customerNo: this.modalData.customerNo,
                customerDesc: this.modalData.customerDesc,
                status: this.modalData.status,
                active: this.modalData.active,
                closeDate: this.modalData.projectCloseDate,
                buildDate: this.modalData.projectCreationDate,
                priority: this.modalData.priority,
                testPartNo: 'P000000',
                partDesc: '无物料',
                partType: 'Active',
              }
              eamProjectInfoSave(this.modalData).then(({data}) => {
                if (data && data.code === '0') {
                  eamProjectInfoSearch(this.searchData).then(({data}) => {
                    if (data && data.code === 0) {
                      inData.projectId = data.page.list[0].projectId
                      eamProjectPartInfoSave(inData).then(({data}) => {
                        if (data && data.code === 0) {
                          this.getDataList()
                          this.modalFlag = false
                          EventBus.$emit('updateProjectPartInfo')
                          this.$message({
                            message: '操作成功',
                            type: 'success',
                            duration: 1500,
                            onClose: () => {
                            },
                          })
                        } else {
                          this.$alert(data.msg, '错误', {
                            confirmButtonText: '确定'
                          })
                        }
                      })
                    }
                  })
                } else {
                  this.$alert(data.msg, '错误', {
                    confirmButtonText: '确定'
                  })
                }
              })
            }
          }).catch(() => {
            // 如果点击取消提示已取消操作
            this.$message({
              type: 'info',
              message: '已取消操作'
            })
          })
        } else if (this.modalData.flag === '2'){
          let inData = {
            projectId : this.modalData.projectId,
            projectNo: this.modalData.projectNo,
            projectDesc: this.modalData.projectDesc,
            projectCategory: this.modalData.projectCategory,
            projectCloseDate: this.modalData.projectCloseDate,
            needDate: this.modalData.needDate,
            cProjectRegion: this.modalData.cProjectRegion,
            projectManager: this.modalData.projectManager,
            projectOwner: this.modalData.projectOwner,
            engineer: this.modalData.engineer,
            cQualityEngineer1: this.modalData.cQualityEngineer1,
            cQualityEngineer2: this.modalData.cQualityEngineer2,
            cQualityEngineer3: this.modalData.cQualityEngineer3,
            cQualityEngineer4: this.modalData.cQualityEngineer4,
            cQualityEngineer5: this.modalData.cQualityEngineer5,
            cQualityEngineer6: this.modalData.cQualityEngineer6,
            cManufactureEngineer: this.modalData.cManufactureEngineer,
            docEngineer: this.modalData.docEngineer,
            projectCreationDate: this.modalData.projectCreationDate,
            createDate: this.modalData.createDate,
            createBy: this.modalData.createBy,
            updateBy: this.modalData.updateBy,
            site: this.modalData.site,
            bu: this.modalData.bu,
            customerNo: this.modalData.customerNo,
            customerDesc: this.modalData.customerDesc,
            active: this.modalData.active,
            closeDate : this.modalData.projectCloseDate,
            buildDate : this.modalData.projectCreationDate,
            priority: this.modalData.priority,
            testPartNo: 'P000000',
            partDesc: '无物料',
          }
          if (new Date(this.modalData.needDate).getTime() < new Date().getTime()) {
            this.$confirm('预计完成日期小于当前日期，确定继续保存？', '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              eamProjectInfoEdit(this.modalData).then(({data}) => {
                if (data && data.code === '0') {
                  if (this.projectPartList.length !== 0 && this.projectPartList[0].testPartNo === 'P000000') {
                    inData.projectPartId = this.projectPartList[0].projectPartId
                    eamProjectPartInfoEdit(inData).then(({data}) => {
                      if (data && data.code !== 0) {
                        this.$alert(data.msg, '错误', {
                          confirmButtonText: '确定'
                        })
                      }
                    })
                  }
                  this.getDataList()
                  this.modalFlag=false
                  EventBus.$emit('updateProjectPartInfo')
                  this.$message({
                    message: '操作成功',
                    type: 'success',
                    duration: 1500,
                    onClose: () => {}
                  })
                } else {
                  this.$alert(data.msg, '错误', {
                    confirmButtonText: '确定'
                  })
                }
              })
            }
            ).catch(() => {
              // 如果点击取消提示已取消操作
              this.$message({
                type: 'info',
                message: '已取消操作'
              })
            })
          }
          else {
            eamProjectInfoEdit(this.modalData).then(({data}) => {
              if (data && data.code === '0') {
                if (this.projectPartList.length !== 0 && this.projectPartList[0].testPartNo === 'P000000') {
                  inData.projectPartId = this.projectPartList[0].projectPartId
                  eamProjectPartInfoEdit(inData).then(({data}) => {
                    if (data && data.code !== 0) {
                      this.$alert(data.msg, '错误', {
                        confirmButtonText: '确定'
                      })
                    }
                  })
                }
                this.getDataList()
                this.modalFlag=false
                EventBus.$emit('updateProjectPartInfo')
                this.$message({
                  message: '操作成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {}
                })
              } else {
                this.$alert(data.msg, '错误', {
                  confirmButtonText: '确定'
                })
              }
            })
          }
        } else if (this.modalData.flag === '3') {
          if (this.modalData.testPartNo === '' || this.modalData.testPartNo == null) {
            this.$message.warning('请输入项目料号！')
            return
          }
          if (this.modalData.partDesc === '' || this.modalData.partDesc == null) {
            this.$message.warning('请输入料号描述！')
            return
          }
          if (this.modalData.partType === '' || this.modalData.partType == null) {
            this.$message.warning('请选择料号状态！')
            return
          }
          this.modalData.closeDate = this.modalData.projectCloseDate
          this.modalData.buildDate = this.modalData.projectCreationDate
          eamProjectPartInfoSave(this.modalData).then(({data}) => {
            if (data && data.code === 0) {
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
              this.refreshCurrentTabTable()
              this.modalFlag=false
              EventBus.$emit('updateProjectPartInfo')
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        } else {
          if (this.modalData.testPartNo === '' || this.modalData.testPartNo == null) {
            this.$message.warning('请输入项目料号！')
            return
          }
          if (this.modalData.partDesc === '' || this.modalData.partDesc == null) {
            this.$message.warning('请输入料号描述！')
            return
          }
          if (this.modalData.partType === '' || this.modalData.partType == null) {
            this.$message.warning('请选择料号状态！')
            return
          }
          this.modalData.closeDate = this.modalData.projectCloseDate
          this.modalData.buildDate = this.modalData.projectCreationDate
          this.modalData.partType = 'Active'
          eamProjectPartInfoEdit(this.modalData).then(({data}) => {
            if (data && data.code === 0) {
              this.refreshCurrentTabTable()
              this.modalFlag=false
              EventBus.$emit('updateProjectPartInfo')
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        }
      },
      searchBusinessInfoList1 () {
        searchBusinessInfo1(this.searchBusinessData1).then(({data}) => {
          if (data && data.code === 0){
            this.businessDataList1 = data.rows;
          }
        })
      },
      searchBusinessInfoList () {
        searchBusinessInfo(this.searchBusinessData).then(({data}) => {
          if (data && data.code === 0){
            this.businessDataList = data.rows;
          }
        })
      },
      searchBusinessInfoList2 () {
        searchBusinessInfo2(this.searchBusinessData2).then(({data}) => {
          if (data && data.code === 0){
            this.businessDataList2 = data.rows;
          }
        })
      },
      searchBusinessInfoList3 () {
        searchBusinessInfo3(this.searchBusinessData3).then(({data}) => {
          if (data && data.code === 0){
            this.businessDataList3 = data.rows;
          }
        })
      },
      searchBusinessInfoList4 () {
        searchBusinessInfo4(this.searchBusinessData4).then(({data}) => {
          if (data && data.code === 0){
            this.businessDataList4 = data.rows;
          }
        })
      },
      searchBusinessInfoList5 () {
        searchBusinessInfo5(this.searchBusinessData5).then(({data}) => {
          if (data && data.code === 0){
            this.businessDataList5 = data.rows;
          }
        })
      },
      searchBusinessInfoList6 () {
        searchBusinessInfo6(this.searchBusinessData6).then(({data}) => {
          if (data && data.code === 0){
            this.businessDataList6 = data.rows;
          }
        })
      },
      searchBusinessInfoList7 () {
        searchBusinessInfo7(this.searchBusinessData7).then(({data}) => {
          if (data && data.code === 0){
            this.businessDataList7 = data.rows;
          }
        })
      },
      // 打开项目经理
      openProjectManagerInfoDialog () {
        //请求
        this.searchBusinessInfoList();
      },
      // 打开项目负责人
      openProjectOwnerInfoDialog () {
        //请求
        this.searchBusinessInfoList1();
      },
      // 打开工程师
      openEngineerInfoDialog () {
        //请求
        this.searchBusinessInfoList2();
      },
      // 打开IPQC
      openIPQCInfoDialog () {
        //请求
        this.searchBusinessInfoList3();
      },
      // 打开FQC1
      openFQC1InfoDialog () {
        //请求
        this.searchBusinessInfoList4();
      },
      // 打开MFG
      openMFGInfoDialog () {
        //请求
        this.searchBusinessInfoList5();
      },
      // 打开文档工程师
      openDocEngineerInfoDialog () {
        //请求
        this.searchBusinessInfoList7();
      },
      openEngineer6InfoDialog () {
        //请求
        this.searchBusinessInfoList6();
      },
      // 关闭
      closeProjectManagerInfoDialog () {
        this.businessDataList = []
        this.projectManagerFlag = false
      },
      closeProjectOwnerInfoDialog () {
        this.businessDataList1 = []
        this.projectOwnerFlag = false
      },
      //关闭
      closeEngineerInfoDialog () {
        this.businessDataList2 = []
        this.engineerFlag = false
      },
      closeEngineer6InfoDialog () {
        this.businessDataList6 = []
        this.engineer6Flag = false
      },
      //关闭
      closeIPQCInfoDialog () {
        this.businessDataList3 = []
        this.IPQCFlag = false
      },
      //关闭
      closeFQC1InfoDialog () {
        this.businessDataList4 = []
        this.FQC1Flag = false
      },
      //关闭
      closeMFGInfoDialog () {
        this.businessDataList5 = []
        this.MFGlag = false
      },
      //关闭
      closeDocEngineerInfoDialog () {
        this.businessDataList7 = []
        this.docEngineerFlag = false
      },
      projectManagerRowDblclick(row) {
        if (row && row.username && row.userDisplay) {
          this.modalData.projectManager = row.username + '-' + row.userDisplay;
          if (this.modalData.projectManager) {
            this.modalData.projectManagerName = this.modalData.projectManager.split('-')[1];
          }
        }
        this.projectManagerFlag = false;
      },
      projectOwnerRowDblclick (row) {
        this.modalData.projectOwner = row.username + '-' + row.userDisplay
        this.modalData.projectOwnerName = this.modalData.projectOwner.split('-')[1] // 截取用户名
        this.projectOwnerFlag = false
      },
      engineerRowDblclick (row) {
        this.modalData.cQualityEngineer1 = row.username + '-' + row.userDisplay
        this.modalData.cQualityEngineer1Name = this.modalData.cQualityEngineer1.split('-')[1] // 截取用户名
        this.engineerFlag = false
      },
      engineer6RowDblclick (row) {
        this.modalData.engineer = row.username + '-' + row.userDisplay
        this.modalData.engineerName = this.modalData.engineer.split('-')[1] // 截取用户名
        this.engineer6Flag = false
      },
      IPQCRowDblclick (row) {
        this.modalData.cQualityEngineer2 = row.username + '-' + row.userDisplay
        this.modalData.cQualityEngineer2Name = this.modalData.cQualityEngineer2.split('-')[1] // 截取用户名
        this.IPQCFlag = false
      },
      FQC1RowDblclick (row) {
        this.modalData.cQualityEngineer3 = row.username + '-' + row.userDisplay
        this.modalData.cQualityEngineer3Name = this.modalData.cQualityEngineer3.split('-')[1] // 截取用户名
        this.FQC1Flag = false
      },
      MFGRowDblclick (row) {
        this.modalData.cManufactureEngineer = row.username + '-' + row.userDisplay
        this.modalData.cManufactureEngineerName = this.modalData.cManufactureEngineer.split('-')[1] // 截取用户名
        this.MFGlag = false
      },
      docEngineerRowDblclick (row) {
        this.modalData.docEngineer = row.username + '-' + row.userDisplay
        this.modalData.docEngineerName = this.modalData.docEngineer.split('-')[1] // 截取用户名
        this.docEngineerFlag = false
      },
      closeClear () {
        this.modalData.bu = ''
        this.modalData.projectNo = ''
        this.modalData.projectDesc = ''
        this.modalData.projectCloseDate = ''
        this.modalData.needDate = ''
        this.modalData.customerNo = ''
        this.modalData.customerDesc = ''
        this.modalData.projectCategory = ''
        this.modalData.testPartNo = ''
        this.modalData.partDesc = ''
        this.modalData.projectManager = ''
        this.modalData.projectManagerName = ''
        this.modalData.engineer = ''
        this.modalData.engineerName = ''
        this.modalData.cQualityEngineer1 = ''
        this.modalData.cQualityEngineer1Name = ''
        this.modalData.cQualityEngineer2 = ''
        this.modalData.cQualityEngineer2Name = ''
        this.modalData.cQualityEngineer3 = ''
        this.modalData.cQualityEngineer3Name = ''
        this.modalData.cQualityEngineer4 = ''
        this.modalData.cQualityEngineer4Name = ''
        this.modalData.cQualityEngineer5 = ''
        this.modalData.cQualityEngineer5Name = ''
        this.modalData.cQualityEngineer6 = ''
        this.modalData.cQualityEngineer6Name = ''
        this.modalData.cManufactureEngineer = ''
        this.modalData.cManufactureEngineerName = ''
        this.modalData.docEngineer = ''
        this.modalData.docEngineerName = ''
        this.modalData.projectCreationDate = new Date()
      },

      getProjectPartInfo () {
        let queryProjectPart = {
          projectId: this.projectPartCurrentRow.projectId,
          projectNo: this.projectPartCurrentRow.projectNo,
          site: this.projectPartCurrentRow.site,
          buNo: this.projectPartCurrentRow.buNo,
          userName: this.$store.state.user.name,
          limit: -1,
          page: 1
        }
        eamProjectPartSearch(queryProjectPart).then(({data}) => {
          if (data && data.code === 0) {
            this.projectPartList = data.page.list
            // 遍历dataList
            this.projectPartList.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]
              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]
              }
              item.cManufactureEngineerName = item.cManufactureEngineer.split('-')[1]
              if (item.docEngineer != null && item.docEngineer !== ''){
                item.docEngineerName = item.docEngineer.split('-')[1]
              }
            })
          }
        })
      },

      addProjectPartModal (row) {
        this.modalData = {
          flag: '3',
          site: row.site,
          bu: row.site + '_' + row.buNo,
          projectPartId: '',
          customerNo: row.customerNo,
          customerDesc: row.customerDesc,
          projectCategory: row.projectCategory,
          testPartNo: '',
          partDesc: '',
          projectId: row.projectId,
          projectNo: row.projectNo,
          projectDesc: row.projectDesc,
          priority: row.priority,
          projectCloseDate: row.projectCloseDate,
          needDate: row.needDate,
          projectManager: row.projectManager,
          projectManagerName: row.projectManager.split('-')[1], // 截取用户名
          projectOwner: row.projectOwner,
          projectOwnerName: row.projectOwner.split('-')[1], // 截取用户名
          engineer: row.engineer,
          engineerName: row.engineer.split('-')[1], // 截取用户名
          cQualityEngineer1: row.cQualityEngineer1,
          cQualityEngineer1Name: row.cQualityEngineer1.split('-')[1], // 截取用户名
          cQualityEngineer2: row.cQualityEngineer2,
          cQualityEngineer2Name: row.cQualityEngineer2.split('-')[1], // 截取用户名
          cQualityEngineer3: row.cQualityEngineer3,
          cQualityEngineer3Name: row.cQualityEngineer3.split('-')[1], // 截取用户名
          cQualityEngineer4: row.cQualityEngineer4,
          cQualityEngineer5: row.cQualityEngineer5,
          cQualityEngineer6: row.cQualityEngineer6,
          cManufactureEngineer: row.cManufactureEngineer,
          cManufactureEngineerName: row.cManufactureEngineer.split('-')[1], // 截取用户名
          docEngineer: row.docEngineer,
          projectCreationDate: row.projectCreationDate,
          status: '草稿',
          partType: 'Active',
          // active: row.active,
          createBy: this.$store.state.user.name,
          updateBy: this.$store.state.user.name,
        }
        if (row.cQualityEngineer4 != null && row.cQualityEngineer4 !== ''){
          this.modalData.cQualityEngineer4Name= row.cQualityEngineer4.split('-')[1] // 截取用户名
        } else {
          this.modalData.cQualityEngineer4 = ''
        }
        if (row.cQualityEngineer5 != null && row.cQualityEngineer5 !== ''){
          this.modalData.cQualityEngineer5Name= row.cQualityEngineer5.split('-')[1] // 截取用户名
        } else {
          this.modalData.cQualityEngineer5 = ''
        }
        if (row.cQualityEngineer6 != null && row.cQualityEngineer6 !== ''){
          this.modalData.cQualityEngineer6Name= row.cQualityEngineer6.split('-')[1] // 截取用户名
        } else {
          this.modalData.cQualityEngineer6 = ''
        }
        if (row.docEngineer != null && row.docEngineer !== ''){
          this.modalData.docEngineerName= row.docEngineer.split('-')[1] // 截取用户名
        } else {
          this.modalData.docEngineer = ''
        }
        this.modalDisableFlag = true
        this.modalPartDisableFlag = true
        this.modalFlag = true
      },

      updatePartModal (row) {
        this.modalData = {
          flag: '4',
          site: row.site,
          bu: this.projectPartCurrentRow.site + '_' + this.projectPartCurrentRow.buNo,
          customerNo: row.customerNo,
          customerDesc: row.customerDesc,
          projectCategory: row.projectCategory,
          testPartNo: row.testPartNo,
          partDesc: row.partDesc,
          projectId: row.projectId,
          projectNo: row.projectNo,
          projectDesc: row.projectDesc,
          projectPartId: row.projectPartId,
          priority: row.priority,
          projectCloseDate: row.closeDate,
          needDate: row.needDate,
          projectManager: row.projectManager,
          projectManagerName: row.projectManager.split('-')[1], // 截取用户名
          projectOwner: row.projectOwner,
          projectOwnerName: row.projectOwner.split('-')[1], // 截取用户名
          engineer: row.engineer,
          engineerName: row.engineer.split('-')[1], // 截取用户名
          cQualityEngineer1: row.cQualityEngineer1,
          cQualityEngineer1Name: row.cQualityEngineer1.split('-')[1], // 截取用户名
          cQualityEngineer2: row.cQualityEngineer2,
          cQualityEngineer2Name: row.cQualityEngineer2.split('-')[1], // 截取用户名
          cQualityEngineer3: row.cQualityEngineer3,
          cQualityEngineer3Name: row.cQualityEngineer3.split('-')[1], // 截取用户名
          cQualityEngineer4: row.cQualityEngineer4,
          cQualityEngineer5: row.cQualityEngineer5,
          cQualityEngineer6: row.cQualityEngineer6,
          cManufactureEngineer: row.cManufactureEngineer,
          cManufactureEngineerName: row.cManufactureEngineer.split('-')[1], // 截取用户名
          docEngineer: row.docEngineer,
          projectCreationDate: row.buildDate,
          status: row.status,
          partType: row.partType,
          // active: row.active,
          createBy: this.$store.state.user.name,
          updateBy: this.$store.state.user.name,
        }
        if (row.cQualityEngineer4 != null && row.cQualityEngineer4 !== ''){
          this.modalData.cQualityEngineer4Name= row.cQualityEngineer4.split('-')[1] // 截取用户名
        }
        if (row.cQualityEngineer5 != null && row.cQualityEngineer5 !== ''){
          this.modalData.cQualityEngineer5Name= row.cQualityEngineer5.split('-')[1] // 截取用户名
        }
        if (row.cQualityEngineer6 != null && row.cQualityEngineer6 !== ''){
          this.modalData.cQualityEngineer6Name= row.cQualityEngineer6.split('-')[1] // 截取用户名
        }
        if (row.docEngineer != null && row.docEngineer !== ''){
          this.modalData.docEngineerName= row.docEngineer.split('-')[1] // 截取用户名
        }
        this.modalDisableFlag = true
        this.modalPartDisableFlag = true
        this.modalFlag = true
      },

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

      deletePartModal (row) {
        this.$confirm(`是否删除这个项目料号信息?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          eamProjectPartInfoDelete(row).then(({data}) => {
            if (data && data.code === 0) {
              this.getDataList()
              EventBus.$emit('updateProjectPartInfo')
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {}
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        }).catch(() => {
        })
      },

      // 动态列开始 获取 用户保存的 格式列
      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.columnList = data.rows
                break;
              case 2:
                this.columnPartList = data.rows
                break;
              // case 3:
              //   this.columnList2 = data.rows
              //   break;
              // case 4:
              //   this.columnList3 = data.rows
              //   break;
            }
          } else {
            this.getColumnList(tableId, columnId)
          }
        })
      },
      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 '';
        }
      },
      // 获取 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.columnList = data.rows
                break;
              case 2:
                this.columnPartList = data.rows
                break;
              // case 3:
              //   this.columnList2 = data.rows
              //   break;
              // case 4:
              //   this.columnList3 = data.rows
              //   break;
            }
          } else {
            // this.showDefault = true.
          }
        })
      },
      // 列表表格选择替换
      tabClick (tab, event) {
        // 刷新列表数据
        this.refreshCurrentTabTable()
      },
      refreshCurrentTabTable () {
        if (this.activeName == 'projectPart') {
          this.getProjectPartInfo();
        }
      },
      //获取按钮的权限数据
      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
      },
      rowStyle ({row}) {
        if (this.projectPartCurrentRow.testPartNo === row.testPartNo) {
          return { 'background-color': '#E8F7F6', cursor: 'pointer' };
        }
      },
    }
  }
</script>
<style scoped lang="scss">
.el-tabs__nav {
  margin-left: 0 !important;
}
.red-text /deep/ .el-input__inner {
  color: red;
}
/deep/ .left-section {
  flex: 1; /* 左边部分占据剩余空间 */
  margin-right: 10px; /* 右边与左边之间的间隔 */
  margin-left: -10px; /* 左边与父元素之间的间隔 */
}

/deep/ .right-section {
  width: 66%; /* 右边部分宽度占满剩余空间 */
  margin-right: 5px;
}

/deep/ .custom-upload .el-upload-dragger {
  width: 150px;
  height: 150px;
  text-align: center;
  position: relative;
  overflow: hidden;
  /* 添加其他样式 */
}

/deep/ .table-container {
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  padding: 10px;
  margin-bottom: 10px;
}
</style>
