<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.testPartNo" style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'料号描述'">
        <el-input v-model="searchData.partDesc" style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'客户编码'">
        <el-input v-model="searchData.customerNo" style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'客户名称'">
        <el-input v-model="searchData.customerDesc" style="width: 120px"></el-input>
      </el-form-item>
      <el-form-item :label="'项目分类'">
        <el-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="'ERP正式料号'">
        <el-select v-model="searchData.finalPartNo" placeholder="请选择" clearable style="width: 130px">
          <el-option
            v-for = "i in finalPartNosList"
            :key = "i.finalPartNoId"
            :label = "i.finalPartNo"
            :value = "i.finalPartNo">
          </el-option>
        </el-select>
      </el-form-item>
      <el-form-item :label="'转量产日期：'">
        <el-date-picker
          style="width: 120px"
          v-model="searchData.massProductionStartDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择日期">
        </el-date-picker>
        -
        <el-date-picker
          style="width: 120px"
          v-model="searchData.massProductionEndDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item :label="'立项日期：'">
        <el-date-picker
          style="width: 120px"
          v-model="searchData.startDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择日期">
        </el-date-picker>
      -
        <el-date-picker
          style="width: 120px"
          v-model="searchData.endDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="选择日期">
        </el-date-picker>
      </el-form-item>
<!--      <el-form-item :label="'在用'">-->
<!--        <el-select filterable v-model="searchData.active" style="width: 130px">-->
<!--          <el-option label="全部" value=""></el-option>-->
<!--          <el-option label="是" value="Y"></el-option>-->
<!--          <el-option label="否" value="N"></el-option>-->
<!--        </el-select>-->
<!--      </el-form-item>-->
      <el-form-item :label="' '">
        <el-button  @click="agencyMatter()">查询</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 + 50"
      :data="dataList"
      ref="mainTable"
      highlight-current-row
      @row-click="proofingClickRow"
      @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">
          <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-if="scope.row.status === '正式量产'">
            <span v-if="!item.columnHidden" style="color: #7fa103;">{{scope.row[item.columnProp]}}</span>
            <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
                                               style="width: 100px; height: 80px"/></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-column
        v-if="!this.allMFGList.includes(this.$store.state.user.name) || this.$store.state.user.name === 'admin'"
        fixed="right"
        header-align="center"
        align="center"
        width="180"
        label="操作">
        <template slot-scope="scope">
          <div v-if="scope.row.partType !== 'Active'">
            <a v-if="scope.row.status === '草稿' && scope.row.status !== '已量产'" style="color: gray; pointer-events: none;">下达</a>
            <a v-if="scope.row.status !== '草稿' && scope.row.status !== '已量产'" style="color: gray; pointer-events: none;">新增打样</a>
            <a v-if="scope.row.status !== '草稿' && scope.row.status !== '已量产'" style="color: gray; pointer-events: none;">转正式料号</a>
            <a v-if="scope.row.status === '进行中' && scope.row.status !== '已量产'" style="color: gray; pointer-events: none;">转量产</a>
          </div>
          <div v-else-if="scope.row.status !== '已量产' && scope.row.status !== '正式量产'">
            <a v-if="scope.row.status === '草稿' && scope.row.status !== '已量产'" type="text" size="small" @click="updateModalStatus(scope.row)">下达</a>
            <a v-if="scope.row.status !== '草稿'" type="text" size="small" @click="addProofRecord(scope.row)">新增打样</a>
            <a v-if="scope.row.status !== '草稿' && scope.row.status !== '已量产'" type="text" size="small" @click="changeFormalPartNo(scope.row)">转正式料号</a>
            <a v-if="scope.row.status === '进行中' || scope.row.status === '已量产'" type="text" size="small" @click="updateModalStatus(scope.row)">转量产</a>
          </div>
          <div v-else-if="scope.row.status === '已量产'">
            <a style="color: #0c4dbb" type="text" size="small" @click="addProofRecord(scope.row)">新增打样</a>
            <a style="color: #0c4dbb" type="text" size="small" @click="changeFormalPartNo(scope.row)">转正式料号</a>
            <a style="color: #0c4dbb" type="text" size="small" @click="updateModalStatus(scope.row)">转量产</a>
          </div>
          <div v-else>
            <a style="color: red" type="text" size="small" @click="addProofRecord(scope.row)">新增打样</a>
            <a style="color: red" type="text" size="small" @click="changeFormalPartNo(scope.row)">转正式料号</a>
            <a style="color: red" type="text" size="small" @click="updateModalStatus(scope.row)">转量产</a>
          </div>
        </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="转正式料号" :visible.sync="formalPartNoFlag" width="421px" v-drag :close-on-click-modal="false">
      <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="客户编码" prop="customerNo" >
          <el-input v-model="modalData.customerNo" style="width: 110px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="客户名称" prop="customerDesc" >
          <el-input v-model="modalData.customerDesc" style="width: 260px;" disabled></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="项目编码" prop="projectNo" >
          <el-input v-model="modalData.projectNo" style="width: 110px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="项目名称" prop="projectDesc" >
          <el-input v-model="modalData.projectDesc" style="width: 160px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="BU" prop="bu" >
          <el-input v-model="modalData.bu" style="width: 86px;" disabled></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="项目料号" prop="testPartNo" >
          <el-input v-model="modalData.testPartNo" style="width: 110px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="料号描述" prop="partDesc"  >
          <el-input v-model="modalData.partDesc" style="width: 260px;" disabled></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 label="ERP正式料号" prop="finalPartNo" :rules="rules.finalPartNo">
          <el-input v-model="modalData.finalPartNo"
                    @blur="getFinalPartDesc()"
                    style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="ERP正式料号描述" prop="finalPartDesc">
          <el-input v-model="modalData.finalPartDesc" style="width: 260px" disabled></el-input>
        </el-form-item>
      </el-form>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button type="primary" @click="saveFormalPartNo()">保存</el-button>
        <el-button @click="formalPartNoFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <el-tabs style="margin-top: 0px; width: 100%; height: 100%;" v-model="activeName" class="customer-tab" type="border-card" @tab-click="tabClick">
      <el-tab-pane label="打样记录" name="proofRecord" style="margin-left: -10px">
        <proofRecord ref="proofRecord"></proofRecord>
      </el-tab-pane>
      <el-tab-pane label="转量产阶段文档" name="massProductionStage">
        <el-button type="primary" icon="el-icon-upload" style="margin-top: -5px" @click="projectDocumentList()">文档清单定义</el-button>
          <el-button type="primary" v-if="this.proofingCurrentRow.status !== '草稿'" icon="el-icon-upload" style="margin-top: -5px" @click="uploadOtherDocument()">上传其他文档</el-button>
        <el-button type="primary" v-if="this.sendMassMailFlag === true" style="margin-top: -5px" @click="sendMassMailHandle()">邮件提醒</el-button>
        <el-table
            :data="projectOtherDocumentList"
            border
            style="width: 100%;margin-top: 5px;"
            :height="this.height + 110"
            ref="proofDocumentTable"
            @row-click="projectOtherDocumentClickRow"
            @current-change="changeCurrentRow1"
            v-loading="dataListLoading">
            <el-table-column
              header-align="center"
              align="center"
              width="150"
              fixed="left"
              label="操作">
              <template slot-scope="scope">
                <a type="primary" v-if="scope.row.documentDefinitionListId !== '-1'" @click="uploadFile(scope.row)">上传文件</a>
                <a type="text" size="small" v-if="scope.row.documentDefinitionListId !== '-1' && !shouldShowDelete(scope.row)" @click="warnSendMail(scope.row)">提醒</a>
                <a type="text" size="small" v-if="shouldShowDelete(scope.row) || scope.row.projectPhase === 'SOP文档'" @click="viewMassDocumentFile(scope.row)">查看附件</a>
                <a type="text" size="small" v-if="shouldShowDelete(scope.row)" @click="massProductionDocumentDelete(scope.row)">删除</a>
              </template>
            </el-table-column>
            <el-table-column label="序号" type="index" align="center" :index="indexMethod">
              <template slot-scope="scope">
                      <span :style="{ color: scope.row.uploadedFlag === 'Y' ? 'green' : '' }">
                        {{ scope.$index + 1 }}
                      </span>
              </template>
            </el-table-column>
            <el-table-column label="文档类型" align="center">
              <template slot-scope="scope">
                      <span :style="{ color: scope.row.uploadedFlag === 'Y' ? '#029315' : '' }">
                        {{ getCombinedDocumentType(scope.row) }}
                      </span>
              </template>
            </el-table-column>
            <el-table-column
              v-for="(item,index) in columnFileContentArray" :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="scope.row.uploadedFlag === 'Y'">
                  <span v-if="!item.columnHidden" style="color: #029315;">{{scope.row[item.columnProp]}}</span>
                  <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
                                                     style="width: 100px; height: 80px"/></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-tab-pane label="所有文档" name="allDocument">
        <el-button type="primary" v-if="this.proofingCurrentRow.status !== '草稿'" icon="el-icon-upload" style="margin-top: -5px" @click="projectProductionValidationDocument()">选择生产确认文档</el-button>
        <el-table
          :data="projectAllDocumentList"
          border
          style="width: 100%;margin-top: 5px;"
          :height="this.height + 50"
          ref="projectAllDocumentDocumentTable"
          @row-click="projectAllDocumentClickRow"
          v-loading="dataListLoading">
          <el-table-column
            header-align="center"
            fixed="left"
            align="center"
            width="80"
            label="操作">
            <template slot-scope="scope">
              <a type="text" size="small" v-if="shouldShowDelete(scope.row) || scope.row.uploadedFlag === 'Y'" @click="viewMassDocumentFile(scope.row)">查看附件</a>
              <a type="text" size="small" v-if="scope.row.uploadedFlag === 'N'" @click="uploadAllDocumentFile(scope.row)">上传文件</a>
            </template>
          </el-table-column>
          <el-table-column label="序号" type="index" align="center" :index="indexMethod">
            <template slot-scope="scope">
                    <span :style="{ color: scope.row.uploadedFlag === 'Y' ? 'green' : '' }">
                      {{ scope.$index + 1 }}
                    </span>
            </template>
          </el-table-column>
          <el-table-column label="文档类型" align="center">
            <template slot-scope="scope">
                    <span :style="{ color: scope.row.uploadedFlag === 'Y' ? '#029315' : '' }">
                      {{ getCombinedDocumentType(scope.row) }}
                    </span>
            </template>
          </el-table-column>
          <el-table-column
            v-for="(item,index) in columnProjectAllDocumentList" :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="scope.row.uploadedFlag === 'Y'">
                <span v-if="!item.columnHidden" style="color: #029315;">{{scope.row[item.columnProp]}}</span>
                <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]"
                                                   style="width: 100px; height: 80px"/></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-tab-pane label="生产文档确认进度" name="productionDocumentsConfirmProgress">
        <el-row>
          <el-col :span="8" class="left-section">
            <div class="table-container" style="height: 100%;margin-top: -5px">
              <p style="margin-top: -5px">文档清单</p>
              <el-table :data="confirmProgressDocumentList"
                        border
                        style="width: 100%;margin-top: -5px;"
                        :height="this.height + 95">
                <el-table-column header-align="center" align="center" width="50" prop="itemNo" label="序号"></el-table-column>
                <el-table-column header-align="center" align="center" prop="documentType" label="文档类型"></el-table-column>
                <el-table-column header-align="center" align="center" prop="fileName" label="文件名"></el-table-column>
                <el-table-column
                  header-align="center"
                  align="center"
                  width="90"
                  fixed="right"
                  label="操作">
                  <template slot-scope="scope">
                    <a type="text" size="small" @click="viewMassDocumentFile(scope.row)">查看附件</a>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </el-col>
          <el-col :span="15" class="right-section">
            <div class="table-container" style="height: 100%;margin-top: -5px">
              <p style="margin-top: -5px">推送人员清单</p>
              <el-table :data="confirmProgressPusherList"
                        border
                        style="width: 100%;margin-top: -5px;"
                        :height="this.height + 95">
                <el-table-column header-align="center" align="center" width="40" prop="itemNo" label="序号"></el-table-column>
                <el-table-column header-align="center" align="center" width="70" prop="userDisplay" label="指定确认人"></el-table-column>
                <el-table-column header-align="center" align="center" :formatter="formatDate" prop="wantedConfirmDate" label="要求确认日期"></el-table-column>
                <el-table-column header-align="center" align="center" prop="confirmFlag" label="是否确认"></el-table-column>
                <el-table-column header-align="center" align="center" prop="confirmedBy" label="实际确认人"></el-table-column>
                <el-table-column header-align="center" align="center" prop="remark" label="备注"></el-table-column>
                <el-table-column header-align="center" align="center" prop="confirmedDate" label="实际确认时间"></el-table-column>
                <el-table-column header-align="center" align="center" prop="createDate" label="推送时间"></el-table-column>
                <el-table-column header-align="center" align="center" prop="createBy" label="推送人"></el-table-column>
                <el-table-column
                  header-align="center"
                  align="center"
                  width="90"
                  fixed="left"
                  label="操作">
                  <template slot-scope="scope">
                    <a type="text" size="small" @click="confirmDocument(scope.row)">确认</a>
                    <a type="text" size="small" @click="viewDocumentFile(scope.row)">查看附件</a>
                  </template>
                </el-table-column>
              </el-table>
            </div>
          </el-col>
        </el-row>
      </el-tab-pane>
      <el-tab-pane label="量产BOM" name="massProductionBOM">
          <el-table
            :data="projectPartBomList"
            row-key="levelCode"
            border
            style="width: 100%; margin-top: 5px;"
            :height="this.height + 50"
            ref="projectBomTable"
            v-loading="dataListLoading"
            :tree-props="{ children: 'children' }">
            <!-- 数据列 -->
            <el-table-column
              label=""
              prop=""
              header-align="center"
              align="right"
              width="50">
            </el-table-column>
            <el-table-column
              v-for="(item, index) in columnProjectBomList"
              :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 === 'levelCode'">
                  <span v-if="scope.row.levelCode === '1'">{{ '主BOM' }}</span>
                  <span v-else>{{ scope.row.levelCode }}</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>

    <el-dialog title="文档清单定义" @close="projectDocumentListVisibleFalse" :visible.sync="projectDocumentListVisible" width="561px" style="margin-top: 10vh" :close-on-click-modal="false">
      <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="项目编码" prop="projectNo" class="red-label">
          <el-input v-model="modalData.projectNo" style="width: 110px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="项目名称" prop="projectDesc" >
          <el-input v-model="modalData.projectDesc" style="width: 170px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="BU" prop="bu">
          <el-input v-model="modalData.bu" style="width: 110px;" disabled></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="客户编码" prop="customerNo" >
          <el-input v-model="modalData.customerNo" style="width: 110px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="客户名称" prop="customerDesc" >
          <el-input v-model="modalData.customerDesc" style="width: 170px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="项目分类" prop="cProjectTypeDb">
          <el-input v-model="modalData.cProjectTypeDb" style="width: 110px;" disabled></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" 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;" disabled></el-input>
        </el-form-item>
        <el-form-item label="料号描述" prop="partDesc"  >
          <el-input v-model="modalData.partDesc" style="width: 170px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="打样单号" prop="proofingNo">
          <el-input v-model="modalData.proofingNo" style="width: 110px;" disabled></el-input>
        </el-form-item>
      </el-form>
      <el-button type="primary" icon="el-icon-upload" style="margin-top: -5px" @click="addProjectDocumentTypeFlag = true">新增</el-button>
      <el-table
        height="200"
        :data="proofDocumentListDefinition"
        border
        style="width: 100%;">
        <el-table-column
          v-for="(item,index) in columnProjectDocumentManifestDefinitionList" :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">{{ getColumnValue(scope.row, item) }}</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="100"
          label="操作">
          <template slot-scope="scope">
            <a v-if="!authDelete" type="text" size="small" @click="deleteProjectDocumentType(scope.row)">删除</a>
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button @click="projectDocumentListVisible = false">关闭</el-button>
      </div>
    </el-dialog>

    <!--  新增文档类型  -->
    <el-dialog title="新增文档类型" @close="closeAddProjectDocumentTypeFlag" @open="searchProjectDocumentTypeList" :visible.sync="addProjectDocumentTypeFlag" width="559px" v-drag :close-on-click-modal="false">
      <el-form inline="inline" label-position="top" :model="searchProjectDocumentTypeData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="文档类型ID">
          <el-input v-model="searchProjectDocumentTypeData.documentTypeId" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="文档类型">
          <el-input v-model="searchProjectDocumentTypeData.documentType" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label="责任部门">
          <el-input v-model="searchProjectDocumentTypeData.responsibleDepartment" clearable style="width: 110px"></el-input>
        </el-form-item>
        <el-form-item label=" ">
          <el-button type="primary" style="padding: 3px 12px" @click="searchProjectDocumentTypeList()">查询</el-button>
        </el-form-item>
      </el-form>
      <el-table
        :height="200"
        :data="extraProjectDocumentList"
        stripe
        border
        @selection-change="selectionProjectDocument"
        style="width: 100%;">
        <el-table-column
          type="selection"
          width="55">
        </el-table-column>
        <el-table-column
          prop="documentTypeId"
          header-align="center"
          align="center"
          label="文档类型ID">
        </el-table-column>
        <el-table-column
          prop="documentType"
          header-align="center"
          align="center"
          label="文档类型">
        </el-table-column>
        <el-table-column
          prop="responsibleDepartment"
          header-align="center"
          align="center"
          label="责任部门">
        </el-table-column>
      </el-table>
      <el-footer style="height:40px;margin-top: 10px;text-align:center">
        <el-button type="primary" @click="saveSelectionProjectDocumentType()">确定</el-button>
        <el-button @click="addProjectDocumentTypeFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>

    <el-dialog title="选择生产确认文档" :visible.sync="projectProductionValidationDocumentVisible" width="1050px" style="margin-top: -5vh" :close-on-click-modal="false">
      <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="项目编码" prop="projectNo" class="red-label">
          <el-input v-model="modalData.projectNo" style="width: 110px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="项目名称" prop="projectDesc" >
          <el-input v-model="modalData.projectDesc" style="width: 170px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="BU" prop="bu">
          <el-input v-model="modalData.bu" style="width: 110px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="项目料号" prop="testPartNo" >
          <el-input v-model="modalData.testPartNo" style="width: 110px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="料号描述" prop="partDesc"  >
          <el-input v-model="modalData.partDesc" style="width: 170px;" disabled></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="客户编码" prop="customerNo" >
          <el-input v-model="modalData.customerNo" style="width: 110px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="客户名称" prop="customerDesc" >
          <el-input v-model="modalData.customerDesc" style="width: 170px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="项目分类" prop="cProjectTypeDb">
          <el-input v-model="modalData.cProjectTypeDb" style="width: 110px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="要求最晚确认日期" prop="wantedConfirmDate" :rules="rules.wantedConfirmDate">
          <el-date-picker
            v-model="modalData.wantedConfirmDate"
            type="date"
            placeholder="选择日期"
            style="width: 110px;">
          </el-date-picker>
        </el-form-item>
      </el-form>
      <el-tabs v-model="activeName1" style="margin-top: 0px; width: 100%; height: 100%;" type="border-card" @tab-click="tabClick" class="customer-tab">
        <el-tab-pane label="文档选择" name="selectDocument" style="width: 104%">
          <el-table
            v-model="selectedDocumentItems"
            :height="height + 250"
            :data="projectAllDocumentList1"
            border
            style="width: 100%;margin-top: -13px;margin-left: -14px !important; margin-right: 0 !important;"
            @selection-change="handleDocumentSelectionChange">
            <el-table-column
              type="selection"
              header-align="center"
              align="center"
              width="50">
            </el-table-column>
            <el-table-column label="序号" type="index" align="center" :index="indexMethod"></el-table-column>
            <el-table-column label="文档类型" align="center">
              <template slot-scope="scope">
                {{ getCombinedDocumentType(scope.row) }}
              </template>
            </el-table-column>
            <el-table-column
              v-for="(item,index) in columnProjectAllDocumentList" :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">{{ getColumnValue(scope.row, item) }}</span>
                <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
              </template>
            </el-table-column>
          </el-table>
        </el-tab-pane>
        <el-tab-pane label="确认人员清单" name="confirmatory" style="width: 104%">
          <div style="font-size: 12px;margin-top: -15px">
            <el-form :inline="true" label-position="top" :model="confirmatoryData">
              <el-form-item :label="'用户账号'">
                <el-input v-model="confirmatoryData.username" clearable style="width: 120px"></el-input>
              </el-form-item>
              <el-form-item :label="'用户名称'">
                <el-input v-model="confirmatoryData.userDisplay" clearable style="width: 200px"></el-input>
              </el-form-item>
              <el-form-item :label="' '">
                <el-button type="primary" @click="searchConfirmatorList()">查询</el-button>
              </el-form-item>
            </el-form>
          </div>
          <el-container style="margin-top: -5px;margin-left: -10px">
            <el-main style="width: 400px; padding: 1px">
              <span style="font-size: 12px" >可选人员</span>
              <el-table
                :height="height + 200"
                :data="projectANotDocumentConfirmatorList"
                border
                ref="confirmatoryTable1"
                @row-click="confirmatoryClickRow1"
                @selection-change="selectionConfirmatory1"
                highlight-current-row
                style="width: 100%">
                <el-table-column
                  type="selection"
                  header-align="center"
                  align="center"
                  :selectable="selectFlag"
                  width="50">
                </el-table-column>
                <el-table-column
                  prop="username"
                  header-align="center"
                  align="center"
                  min-width="80"
                  label="用户账号">
                </el-table-column>
                <el-table-column
                  prop="userDisplay"
                  header-align="center"
                  align="center"
                  min-width="120"
                  label="用户名称">
                </el-table-column>
              </el-table>
            </el-main>
            <el-main style="width: 111px;padding: 1px;margin-right: -20px">
              <div style="margin-top: 126px;margin-left: 7px">
                <el-button type="primary" @click="addConfirmatory()">添加>></el-button>
              </div>
              <div style="margin-top: 15px;margin-left: 7px">
                <el-button type="primary" @click="deleteConfirmatory()">删除<<</el-button>
              </div>
            </el-main>
            <el-main style="width: 400px;padding: 1px;margin-left: -90px">
              <span style="font-size: 12px" >确认人员</span>
              <el-table
                :height="height + 200"
                :data="projectAllDocumentConfirmatorList"
                border
                ref="confirmatoryTable2"
                @row-click="confirmatoryClickRow2"
                @selection-change="selectionConfirmatory2"
                highlight-current-row
                style="width: 96%">
                <el-table-column
                  type="selection"
                  header-align="center"
                  align="center"
                  :selectable="selectFlag"
                  width="50">
                </el-table-column>
                <el-table-column
                  prop="username"
                  header-align="center"
                  align="center"
                  min-width="80"
                  label="用户账号">
                </el-table-column>
                <el-table-column
                  prop="userDisplay"
                  header-align="center"
                  align="center"
                  min-width="120"
                  label="用户名称">
                </el-table-column>
              </el-table>
            </el-main>
          </el-container>
        </el-tab-pane>
      </el-tabs>
      <div slot="footer" class="dialog-footer" style="margin-top: 6px">
        <el-button type="primary" @click="saveProductionValidationDocument()">确定</el-button>
        <el-button @click="closeProjectProductionValidationDocumentVisibleDialog">关闭</el-button>
      </div>
    </el-dialog>

    <el-dialog title="确认" @close="closeUploadFileVisible" :visible.sync="confirmVisible" width="619px" style="margin-top: 0vh;height: 100%;" :close-on-click-modal="false">
      <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="项目编码" prop="projectNo" class="red-label">
          <el-input v-model="modalData.projectNo" style="width: 110px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="项目名称" prop="projectDesc" >
          <el-input v-model="modalData.projectDesc" style="width: 210px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="BU" prop="bu">
          <el-input v-model="modalData.bu" style="width: 110px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="项目分类" prop="cProjectTypeDb">
          <el-input v-model="modalData.cProjectTypeDb" style="width: 110px;" disabled></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="modalData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="项目料号" prop="testPartNo" >
          <el-input v-model="modalData.testPartNo" style="width: 110px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="料号描述" prop="partDesc"  >
          <el-input v-model="modalData.partDesc" style="width: 210px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="指定确认人" prop="userDisplay">
          <el-input v-model="confirmData.userDisplay" disabled style="width: 110px;"></el-input>
        </el-form-item>
        <el-form-item label="要求确认日期" prop="wantedConfirmDate">
          <el-input v-model="confirmData.wantedConfirmDate" style="width: 110px;" disabled></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="confirmData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="备注" prop="remark">
          <el-input v-model="confirmData.remark" style="width: 581px" type="textarea" :rows="1"></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="confirmData" style="margin-left: 7px;margin-top: -15px;">
        <el-form-item label=" ">
          <a href="javascript:void(0);" @click="triggerUpload" type="text" size="small">点击选择文件</a>
          <tr></tr>
          <el-input v-model="this.fileName" readonly placeholder="文件名称" style="width: 581px"></el-input>
          <el-upload class="custom-upload" :file-list="fileList"
                     action="javascript:void(0);" ref="uploadFile"
                     :on-change="onChange" :on-close="closeFileUpdate"
                     multiple :auto-upload="false"
                     style="text-align: left;margin-top: 0px;margin-left: 6px;display: none;">
          </el-upload>
        </el-form-item>
      </el-form>
      <el-table
        :height="this.height + 70"
        :data="projectConfirmatorFileList"
        border
        style="width: 100%;margin-top: 25px;margin-left: 0px;">
        <el-table-column
          prop="fileName"
          header-align="center"
          align="center"
          min-width="180"
          label="文件名">
        </el-table-column>
        <el-table-column
          prop="createDate"
          header-align="center"
          align="center"
          min-width="80"
          label="上传时间">
        </el-table-column>
        <el-table-column
          prop="createdBy"
          header-align="center"
          align="center"
          min-width="60"
          label="上传人">
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer" style="margin-top: 0px">
        <el-button type="primary" @click="saveUploadFile()">确定</el-button>
        <el-button @click="closeUploadFileVisible()">关闭</el-button>
      </div>
    </el-dialog>

    <el-dialog title="查看附件" @close="closeViewDocumentFileVisible" :visible.sync="viewDocumentFileVisible" width="770px" style="margin-top: 0vh" :close-on-click-modal="false">
      <el-table
        :height="height + 200"
        :data="projectConfirmatorFileList"
        border
        style="width: 100%;margin-top: 0px;margin-left: 0px;">
        <el-table-column
          prop="fileName"
          header-align="center"
          align="left"
          min-width="250"
          label="文件名">
        </el-table-column>
        <el-table-column
          prop="createDate"
          header-align="center"
          align="center"
          min-width="80"
          label="上传时间">
        </el-table-column>
        <el-table-column
          prop="createdBy"
          header-align="center"
          align="center"
          min-width="50"
          label="上传人">
        </el-table-column>
        <el-table-column
          header-align="center"
          align="center"
          width="100"
          label="操作">
          <template slot-scope="scope">
            <a type="text" size="small" @click="viewFile(scope.row)">查看</a>
            <a type="text" size="small" @click="downloadFile(scope.row)">下载</a>
            <a type="text" size="small" @click="deleteFile(scope.row)">删除</a>
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer" style="margin-top: 0px">
        <el-button @click="closeViewDocumentFileVisible()">关闭</el-button>
      </div>
    </el-dialog>

    <el-dialog title="查看附件" @close="closeViewMassDocumentFileVisible" :visible.sync="viewMassDocumentFileVisible" width="770px" style="margin-top: 0vh" :close-on-click-modal="false">
      <el-table
        :height="height + 200"
        :data="projectConfirmatorFileList"
        border
        style="width: 100%;margin-top: 0px;margin-left: 0px;">
        <el-table-column
          prop="fileName"
          header-align="center"
          align="left"
          min-width="250"
          label="文件名">
        </el-table-column>
        <el-table-column
          prop="createDate"
          header-align="center"
          align="center"
          min-width="80"
          label="上传时间">
        </el-table-column>
        <el-table-column
          prop="createdBy"
          header-align="center"
          align="center"
          min-width="50"
          label="上传人">
        </el-table-column>
        <el-table-column
          header-align="center"
          align="center"
          width="100"
          label="操作">
          <template slot-scope="scope">
            <a type="text" size="small" @click="viewFile(scope.row)">查看</a>
            <a type="text" size="small" @click="downloadFile(scope.row)">下载</a>
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer" style="margin-top: 0px">
        <el-button @click="closeViewMassDocumentFileVisible()">关闭</el-button>
      </div>
    </el-dialog>

    <el-dialog title="新增打样" :visible.sync="visible" v-drag width="519px" style="margin-top: 20vh" :close-on-click-modal="false">
      <el-form :inline="true" label-position="top" :model="newProofingRecordData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="项目编码" prop="projectNo" >
          <el-input v-model="newProofingRecordData.projectNo" style="width: 110px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="项目名称" prop="projectDesc" >
          <el-input v-model="newProofingRecordData.projectDesc" style="width: 234px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="BU" prop="bu" :rules="rules.bu">
          <el-select v-model="newProofingRecordData.bu" placeholder="请选择" style="width: 110px" disabled>
            <el-option
              v-for = "i in userBuList"
              :key = "i.buNo"
              :label = "i.buDesc"
              :value = "i.buNo">
            </el-option>
          </el-select>
        </el-form-item>
<!--        <el-form-item label="BU" prop="bu" >-->
<!--          <el-input v-model="newProofingRecordData.bu" readonly style="width: 110px;" class="red-text"></el-input>-->
<!--        </el-form-item>-->
      </el-form>
      <el-form :inline="true" label-position="top" :model="newProofingRecordData" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="客户编码" prop="customerNo" >
          <el-input v-model="newProofingRecordData.customerNo" style="width: 110px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="客户名称" prop="customerDesc" >
          <el-input v-model="newProofingRecordData.customerDesc" style="width: 234px;" disabled></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="newProofingRecordData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="项目料号" prop="testPartNo" :rules="rules.testPartNo" >
          <el-input v-model="newProofingRecordData.testPartNo" style="width: 110px;" disabled></el-input>
        </el-form-item>
        <el-form-item label="料号描述" prop="partDesc"  >
          <el-input v-model="newProofingRecordData.partDesc" style="width: 234px;" disabled></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="newProofingRecordData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="项目分类" prop="cProjectTypeDb">
          <el-select v-model="newProofingRecordData.cProjectTypeDb" placeholder="请选择" clearable style="width: 110px">
            <el-option
              v-for = "i in cProjectTypeDbList"
              :key = "i.cProjectTypeDb"
              :label = "i.cProjectTypeDb"
              :value = "i.cProjectTypeDb">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="项目阶段" prop="projectPhase" :rules="rules.projectPhase">
          <el-select v-model="newProofingRecordData.projectPhase" placeholder="请选择" clearable style="width: 110px">
            <el-option
              v-for = "i in projectPhaseList"
              :key = "i.projectPhase"
              :label = "i.projectPhase"
              :value = "i.projectPhase">
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item label="打样单号" prop="proofingNo" :rules="rules.proofingNo" >
          <el-input v-model="newProofingRecordData.proofingNo" style="width: 110px;"></el-input>
        </el-form-item>
        <el-form-item label="数量" prop="proofingNumber" :rules="rules.proofingNo" >
          <el-input v-model="newProofingRecordData.proofingNumber" style="width: 110px"></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="newProofingRecordData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="打样开始日期" prop="" :rules="rules.planStartDate" >
          <el-date-picker
            v-model="newProofingRecordData.planStartDate"
            type="date"
            placeholder="选择日期"
            style="width: 110px;"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="预计完成日期" prop="" :rules="rules.requiredDeliveryDate" >
          <el-date-picker
            v-model="newProofingRecordData.requiredDeliveryDate"
            type="date"
            placeholder="选择日期"
            style="width: 110px;"
          >
          </el-date-picker>
        </el-form-item>
        <el-form-item label="实际完成日期" prop="" >
          <el-date-picker
            v-model="newProofingRecordData.actualityDeliveryDate"
            type="date"
            placeholder="选择日期"
            style="width: 110px;"
            disabled>
          </el-date-picker>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" :model="newProofingRecordData" :rules="rules" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item label="备注" prop="remark">
          <el-input v-model="newProofingRecordData.remark" style="width: 483px"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button @click="visible = false">取 消</el-button>
        <el-button type="primary" @click="newProofingRecord()">确 定</el-button>
      </div>
    </el-dialog>

    <upload-file-list-1 folder="projectPMPDocumentFiles" title="上传文档" :file-list.sync="fileList" :label="'文档类型ID:'" :no="otherDocumentCurrentRow.documentTypeId" :no-type="otherDocumentCurrentRow.documentType"
                        :proofing-id="proofingCurrentRow.proofingId" :proofing-no="proofingCurrentRow.proofingNo" :bu="proofingCurrentRow.buNo" :site="proofingCurrentRow.site" :upload-dialog.sync="uploadDialog" :no-desc="otherDocumentCurrentRow.documentDesc" :id="otherDocumentCurrentRow.id"
                        :project-id="proofingCurrentRow.projectId" :project-no="proofingCurrentRow.projectNo" :project-desc="proofingCurrentRow.projectDesc" :document-type="proofingCurrentRow.documentType" :conclusion="'N/A'"
                        :customer-no="proofingCurrentRow.customerNo" :customer-desc="proofingCurrentRow.customerDesc" :test-part-no="proofingCurrentRow.testPartNo" :project-part-id="proofingCurrentRow.projectPartId" :project-part-no="proofingCurrentRow.projectPartId"
                        :part-desc="proofingCurrentRow.partDesc" :column-file-content-array="columnFileContentArray" :proof-document-list="projectOtherDocumentList"
                        path="/upload/test" :is-editable="isEditable" :is-mass-production-stage="isMassProductionStage"></upload-file-list-1>

    <upload-file-list-2 :folder="this.folder" title="上传文档" :file-list.sync="fileList" :label="'文档类型ID:'" :no="projectAllDocumentCurrentRow.documentTypeId" :no-type="projectAllDocumentCurrentRow.documentType"
                        :proofing-id="projectAllDocumentCurrentRow.proofingId" :proofing-no="projectAllDocumentCurrentRow.proofingNo" :bu="proofingCurrentRow.buNo" :site="proofingCurrentRow.site" :upload-dialog.sync="uploadDialog1" :no-desc="projectAllDocumentCurrentRow.documentDesc" :id="projectAllDocumentCurrentRow.id"
                        :project-id="proofingCurrentRow.projectId" :project-no="proofingCurrentRow.projectNo" :project-desc="proofingCurrentRow.projectDesc" :document-type="proofingCurrentRow.documentType" :conclusion="'N/A'"
                        :customer-no="proofingCurrentRow.customerNo" :customer-desc="proofingCurrentRow.customerDesc" :test-part-no="proofingCurrentRow.testPartNo" :project-part-id="proofingCurrentRow.projectPartId" :project-part-no="proofingCurrentRow.projectPartId"
                        :part-desc="proofingCurrentRow.partDesc" :column-file-content-array="columnFileContentArray" :proof-document-list="projectPartDocumentList"
                        path="/upload/test" :is-editable="isEditable" :is-mass-production-stage="isMassProductionStage"></upload-file-list-2>

    <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 proofRecord from "./com_project_proof_record";
import {
  eamProjectInfoDelete,
  eamProjectInfoEdit,
  eamProjectInfoSave,
  eamProjectInfoSearch,
  saveFormalPartNo
} from "@/api/eam/eamProject.js";
import {getProjectOtherDocument} from "@/api/eam/eamProofing.js";
import UploadFileList1 from "../common/uploadFileList1.vue";
import UploadFileList2 from "../common/uploadFileList1.vue";
import {
  deleteDocumentType, deleteProofDocument,
  editProjectDocument,
  getExtraDocumentList, getProofDocument,
  projectDocumentSave,
  proofingDocumentNEW, proofingDocumentSave, proofingInformationSave,
  searchProjectAllDocument
} from "../../../api/eam/eamProofing";
import {
  deleteAndSaveHandle,
  saveHandle,
  checkConfirmationRecord,
  checkProductionValidationDocument,
  deleteDocumentInformation,
  deleteProjectFile,
  saveProductionValidationDocument,
  saveProductionValidationDocumentConfirmator,
  searchConfirmatorList,
  searchConfirmProgressDocumentList,
  searchConfirmProgressPusherList,
  searchProjectConfirmatorFileList,
  sendMailHandle,
  updateProjectDocumentConfirm,
  uploadProjectFile,
  warnSendMailHandle,
  confirmatorSendMailHandle,
  eamProjectPartSearch,
  eamProjectPartInfoEdit,
  getFinalPartDesc, addConfirmatory, deleteConfirmatory, queryEamProjectPart,searchMassProductionBomList
} from "../../../api/eam/eamProject";
import row from "element-ui/packages/row";
import moment from 'moment';
import 'moment/locale/zh-cn';
import {downLoadObjectFile2} from "../../../api/eam/eam_object_list";
import {EventBus} from "../../../main";
import {arrayToTreeByLevelCode} from "../../../utils/arrayToTreeByLevelCode";
/*打样记录組件*/

  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);
      },
      finalPartNosList() {
        return this.allPersonnelInfoList.filter(item => item.finalPartNoId !== undefined);
      },
  },
    components: {
      UploadFileList1,
      UploadFileList2,
      Chooselist,
      proofRecord,
    },
    watch: {
      searchData: {
        deep: true,
        handler: function (newV, oldV) {
          this.searchData.customerNo = this.searchData.customerNo.toUpperCase()
        }
      },
      projectProductionValidationDocumentVisible(newVal) {
        if (newVal) {
          this.activeName1 = 'selectDocument';
        }
      },
      // 如果projectOtherDocumentList改变，遍历projectOtherDocumentList
      projectOtherDocumentList: {
        deep: true,
        handler: function (newV, oldV) {
          const sendMassMailFlags = [];
          this.projectOtherDocumentList.forEach(item => {
            if (item.uploadedFlag === 'N') {
              sendMassMailFlags.push(item.uploadedFlag)
            }
          })
          this.sendMassMailFlag = sendMassMailFlags.includes('N');
        }
      },
    },
    data () {
      return {
        // 是否收藏
        favorite: false,
        // 导出 start
        exportData: [],
        exportName: "项目物料" + this.dayjs().format('YYYYMMDDHHmmss'),
        exportHeader: ["项目物料"],
        exportFooter: [],
        exportList:[],
        // 导出 end
        tagNo:'',
        fileName:'',
        folder: '',
        selectTypeFlag: [],
        searchData: {
          site: this.$store.state.user.site,
          userName: this.$store.state.user.name,
          projectId: '',
          projectNo: '',
          projectDesc: '',
          testPartNo: '',
          partDesc: '',
          customerNo: '',
          customerDesc: '',
          buDesc: '',
          projectCategory: '',
          status: '',
          startDate:'',
          endDate:'',
          projectCreationDate: new Date(),
          projectCloseDate:'',
          needDate:'',
          projectManager: '',
          projectOwner: '',
          engineer: '',
          cProjectRegion: '',
          finalPartNo: '',
          massProductionStartDate: '',
          massProductionEndDate: '',
          // active: 'Y',
          page: 1,
          limit: 10,
        },
        searchData1: {
          site: this.$store.state.user.site,
          userName: this.$store.state.user.name,
          projectId: '',
          projectNo: '',
          projectDesc: '',
          projectPartId: '',
          testPartNo: '',
          partDesc: '',
          customerNo: '',
          customerDesc: '',
          buDesc: '',
          projectCategory: '',
          status: '',
          startDate:'',
          endDate:'',
          projectCreationDate: new Date(),
          projectCloseDate:'',
          needDate:'',
          // active: 'Y',
          page: 1,
          limit: 10,
        },
        height: 200,
        pageIndex: 1,
        pageSize: 20,
        totalPage: 0,
        businessDataList: [],
        businessDataList1: [],
        businessDataList2: [],
        businessDataList3: [],
        businessDataList4: [],
        businessDataList5: [],
        businessDataList6: [],
        dataList: [],
        dataListSelections: [],
        roleDescList: [],
        projectPartDocumentList: [],
        allPersonnelInfoList: [],
        allMFGList: [],
        //用于储存选中的行数据
        selectedDocumentItems: [],
        // ======== 复选数据集 ========
        businessSelections: [],
        // ======== 选中的当前行数据 ========
        proofingCurrentRow: {},
        otherDocumentCurrentRow: {},
        projectAllDocumentCurrentRow: {},
        fileList: [],
        projectOtherDocumentList: [],
        extraProjectDocumentList: [],
        projectDocumentSelection: [],
        projectAllDocumentList: [],
        projectAllDocumentList1: [],
        confirmatoryList: [],
        projectAllDocumentConfirmatorList: [],
        projectANotDocumentConfirmatorList: [],
        projectPartBomList: [],// 量产BOM原始平面数据数组
        confirmatorySelection1: [],
        confirmatorySelection2: [],
        proofDocumentListDefinition: [],
        confirmProgressPusherList: [],
        confirmProgressDocumentList: [],
        projectConfirmatorFileList: [],
        viewDocumentFileVisible: false,
        viewMassDocumentFileVisible: false,
        sendMassMailFlag: false,
        searchProjectDocumentTypeData: {
          site: this.$store.state.user.site,
          projectId: '',
          projectNo: '',
          proofingNo: '*',
          documentTypeId: '',
          documentType: '',
          documentDesc: '',
          responsibleDepartment: '',
          estimatedCompletionDays: '',
          page: 1,
          limit: 1000
        },
        dataListLoading: false,
        modalFlag:false,
        modalDisableFlag:false,
        formalPartNoFlag:false,
        projectManagerFlag:false,
        projectOwnerFlag:false,
        engineerFlag:false,
        engineer6Flag:false,
        IPQCFlag:false,
        FQC1Flag:false,
        MFGlag:false,
        uploadDialog:false,
        uploadDialog1:false,
        isEditable: true,
        isMassProductionStage: true,
        projectDocumentListVisible: false,
        addProjectDocumentTypeFlag: false,
        projectProductionValidationDocumentVisible: false,
        confirmVisible: false,
        confirmationPrompted: false, // 是否已经进行过确认提示的标志
        agencyMatters: false, // 是否代办事项
        finalPartFlag: false,
        visible: false, // 新增打样模态框
        dataListIndex: 0,
        modalData:{
          flag:'',
          id:'',
          bu: '',
          buNo: '',
          site: this.$store.state.user.site,
          projectId: '',
          projectNo: '',
          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:'',
          wantedConfirmDate: new Date(),
          // active:'',
          createBy: this.$store.state.user.name,
          updateBy: this.$store.state.user.name,
        },
        newProofingRecordData:{
          site: this.$store.state.user.site,
          projectId: '',
          projectNo: '',
          projectDesc: '',
          bu: '',
          buNo: '',
          customerNo: '',
          customerDesc: '',
          testPartNo: '',
          partDesc: '',
          cProjectTypeDb: '',
          projectPhase: '',
          proofingNo: '',
          proofingNumber: '',
          planStartDate: '',
          requiredDeliveryDate: '',
          actualityDeliveryDate: '',
          remark: '',
          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,
        },
        confirmData:{
          site: '',
          projectId: '',
          projectNo: '',
          orderRef1: '',
          orderRef2: '',
          documentId: '',
          documentType: '',
          itemNo: '',
          userid: '',
          wantedConfirmDate: '',
          confirmFlag: '',
          confirmedBy: '',
          remark: '',
          confirmedDate: '',
          createDate: '',
          createBy: '',
          page: 1,
          limit: 1000
        },
        confirmatoryData:{
          username: '',
          userDisplay: ''
        },
        departmentList:[],
        cProjectTypeDbList: [
          {cProjectTypeDb: 'Sustaining'},
          {cProjectTypeDb: 'Low Risk'},
          {cProjectTypeDb: 'High Risk'},

        ],
        projectPhaseList: [
          {projectPhase: 'Prototype'},
          {projectPhase: 'Alpha'},
          {projectPhase: 'Beta'},
          {projectPhase: 'Pre-launch'},
        ],
        activeName: 'proofRecord',
        activeName1: 'selectDocument',
        // 日期限制
        // pickerOptions: {
        //   disabledDate(time) {
        //     return time.getTime() > Date.now();
        //   },
        // },
        // 展示列集
        columnList: [
          {
            userId: this.$store.state.user.name,
            functionId: 401004,
            serialNumber: '401004Table1BuDesc',
            tableId: "401004Table1",
            tableName: "项目物料表",
            columnProp: 'buDesc',
            headerAlign: "center",
            align: "center",
            columnLabel: 'BU',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 401004,
            serialNumber: '401004Table1ProjectNo',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1ProjectDesc',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1TestPartNo',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1PartDesc',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1customerNo',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1customerDesc',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1BuildDate',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1ProjectCategory',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1Priority',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1CProjectRegion',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1ProjectManager',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1ProjectOwner',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1Engineer',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1CQualityEngineer1',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1CQualityEngineer2',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1CQualityEngineer3',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1CQualityEngineer5',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1CQualityEngineer6',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1CManufactureEngineer',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1CQualityEngineer4',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1DocEngineer',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1Status',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table2PartType',
            tableId: "401004Table2",
            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: 401004,
            serialNumber: '401004Table1NeedDate',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1closeDate',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1FinalPartNo',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1CreateDate',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1CreateBy',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1UpdateDate',
            tableId: "401004Table1",
            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: 401004,
            serialNumber: '401004Table1UpdateBy',
            tableId: "401004Table1",
            tableName: "项目物料表",
            columnProp: 'updateBy',
            headerAlign: "center",
            align: "left",
            columnLabel: '更新人',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120,
          },
        ],
        columnFileContentArray: [
          {
            userId: this.$store.state.user.name,
            functionId: 401004,
            serialNumber: '401004Table1FileName',
            tableId: "401004Table1",
            tableName: "打样文档表",
            columnProp: 'fileName',
            headerAlign: "center",
            align: "left",
            columnLabel: '文件名',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 180,
          },
          //是否上传
          {
            userId: this.$store.state.user.name,
            functionId: 401004,
            serialNumber: '401004Table1UploadedFlag',
            tableId: "401004Table1",
            tableName: "打样文档表",
            columnProp: 'uploadedFlag',
            headerAlign: "center",
            align: "center",
            columnLabel: '是否上传',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 70,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 401004,
            serialNumber: '401004Table1ProjectLeader',
            tableId: "401004Table1",
            tableName: "打样文档表",
            columnProp: 'projectLeader',
            headerAlign: "center",
            align: "center",
            columnLabel: '文档负责人',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 70,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 401004,
            serialNumber: '401004Table1Conclusion',
            tableId: "401004Table1",
            tableName: "打样文档表",
            columnProp: 'conclusion',
            headerAlign: "center",
            align: "center",
            columnLabel: '结论',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 70,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 401004,
            serialNumber: '401004Table1DocumentGroupDesc',
            tableId: "401004Table1",
            tableName: "打样文档表",
            columnProp: 'documentGroupDesc',
            headerAlign: "center",
            align: "center",
            columnLabel: '文档种类',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 70,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 103001,
            serialNumber: '103001Table1CreateDate',
            tableId: '103001Table1',
            tableName: '打样文档表',
            columnProp: 'createDate',
            headerAlign: 'center',
            align: 'center',
            columnLabel: '创建时间',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120
          },
          {
            userId: this.$store.state.user.name,
            functionId: 103001,
            serialNumber: '103001Table1CreateBy',
            tableId: '103001Table1',
            tableName: '打样文档表',
            columnProp: 'createdBy',
            headerAlign: 'center',
            align: 'center',
            columnLabel: '创建人',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          }
        ],
        columnProjectDocumentManifestDefinitionList:[
          {
            userId: this.$store.state.user.name,
            functionId: 401004,
            serialNumber: '401004Table1DocumentTypeId',
            tableId: "401004Table1",
            tableName: "BU文档清单表",
            columnProp: 'documentTypeId',
            headerAlign: "center",
            align: "center",
            columnLabel: '文档类型ID',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 120,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 401004,
            serialNumber: '401004Table1DocumentType',
            tableId: "401004Table1",
            tableName: "BU文档清单表",
            columnProp: 'documentType',
            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: 401004,
            serialNumber: '401004Table1ResponsibleDepartment',
            tableId: "401004Table1",
            tableName: "BU文档清单表",
            columnProp: 'responsibleDepartment',
            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: 401004,
            serialNumber: '401004Table1EstimatedCompletionDays',
            tableId: "401004Table1",
            tableName: "BU文档清单表",
            columnProp: 'estimatedCompletionDays',
            headerAlign: "center",
            align: "left",
            columnLabel: '预计完成天数',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80,
          },
        ],
        columnProjectAllDocumentList: [
          {
            userId: this.$store.state.user.name,
            functionId: 401004,
            serialNumber: '401004Table1ProofingId',
            tableId: "401004Table1",
            tableName: "BU文档清单表",
            columnProp: 'proofingNo',
            headerAlign: "center",
            align: "center",
            columnLabel: '打样单号',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 401004,
            serialNumber: '401004Table1ProjectPhase',
            tableId: "401004Table1",
            tableName: "BU文档清单表",
            columnProp: 'projectPhase',
            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: 401004,
            serialNumber: '401004Table1FileName',
            tableId: "401004Table1",
            tableName: "打样文档表",
            columnProp: 'fileName',
            headerAlign: "center",
            align: "left",
            columnLabel: '文件名',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 180,
          },
          //是否上传
          {
            userId: this.$store.state.user.name,
            functionId: 401004,
            serialNumber: '401004Table1UploadedFlag',
            tableId: "401004Table1",
            tableName: "打样文档表",
            columnProp: 'uploadedFlag',
            headerAlign: "center",
            align: "center",
            columnLabel: '是否上传',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 70,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 401004,
            serialNumber: '401004Table1ProjectLeader',
            tableId: "401004Table1",
            tableName: "打样文档表",
            columnProp: 'projectLeader',
            headerAlign: "center",
            align: "center",
            columnLabel: '文档负责人',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 70,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 401004,
            serialNumber: '401004Table1Conclusion',
            tableId: "401004Table1",
            tableName: "打样文档表",
            columnProp: 'conclusion',
            headerAlign: "center",
            align: "center",
            columnLabel: '结论',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 70,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 401004,
            serialNumber: '401004Table1DocumentGroupDesc',
            tableId: "401004Table1",
            tableName: "打样文档表",
            columnProp: 'documentGroupDesc',
            headerAlign: "center",
            align: "center",
            columnLabel: '文档种类',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 70,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 103001,
            serialNumber: '103001Table1CreateDate',
            tableId: '103001Table1',
            tableName: '打样文档表',
            columnProp: 'createDate',
            headerAlign: 'center',
            align: 'center',
            columnLabel: '创建时间',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 130
          },
          {
            userId: this.$store.state.user.name,
            functionId: 103001,
            serialNumber: '103001Table1CreateBy',
            tableId: '103001Table1',
            tableName: '打样文档表',
            columnProp: 'createdBy',
            headerAlign: 'center',
            align: 'center',
            columnLabel: '创建人',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          }
          ],
        columnProjectBomList: [
          {
            userId: this.$store.state.user.name,
            functionId: 401005,
            serialNumber: '401005Table1LevelCode',
            tableId: "401005Table1",
            tableName: "项目物料表",
            columnProp: 'levelCode',
            headerAlign: "center",
            align: "left",
            columnLabel: 'BOM层级',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 100,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 401005,
            serialNumber: '401005Table1PartNo2',
            tableId: "401005Table1",
            tableName: "项目物料BOM表",
            columnProp: 'partNo2',
            headerAlign: "center",
            align: "center",
            columnLabel: '物料编码',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 145,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 401005,
            serialNumber: '401005Table1PartDesc2',
            tableId: "401005Table1",
            tableName: "项目物料BOM表",
            columnProp: 'partDesc2',
            headerAlign: "center",
            align: "left",
            columnLabel: '物料描述',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 500,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 401005,
            serialNumber: '401005Table1QtyAssembly',
            tableId: "401005Table1",
            tableName: "项目物料BOM表",
            columnProp: 'qtyAssembly',
            headerAlign: "center",
            align: "right",
            columnLabel: '用量',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 150,
          },
          {
            userId: this.$store.state.user.name,
            functionId: 401005,
            serialNumber: '401005Table1ScrapFactor',
            tableId: "401005Table1",
            tableName: "项目物料表",
            columnProp: 'scrapFactor',
            headerAlign: "center",
            align: "right",
            columnLabel: '损耗',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 150,
          },
        ],
        levelList: [],
        rules:{
          projectNo:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          projectDesc:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          customerNo:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          customerDesc:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          testPartNo:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          partDesc:[
            {
              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']
            }
          ],
          cQualityEngineer5:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cQualityEngineer6:[
            {
              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']
            }
          ],
          cQualityEngineer4Name:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cQualityEngineer5Name:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          cQualityEngineer6Name:[
            {
              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']
            }
          ],
          needDate:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          projectCreationDate:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          wantedConfirmDate:[
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          projectCategory: [
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          projectPhase: [
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          proofingNo: [
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          planStartDate: [
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          requiredDeliveryDate: [
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          proofingNumber: [
            {
              required: true,
              message: ' ',
              trigger: ['blur','change']
            }
          ],
          //请选择项目分类
          cProjectTypeDb: [
            {
              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: 'Risk',
          },
        ],
        statusList: [
          {
            status: '草稿',
          },
          {
            status: '进行中',
          },
          {
            status: '已量产',
          },
          {
            status: '正式量产',
          }
        ],
        userBuList: [],
        menuId: this.$route.meta.menuId,
      }
    },

    mounted () {
      this.$nextTick(() => {
        this.height = window.innerHeight - 558
      })
      EventBus.$on('updateProjectPartInfo', () => {
        this.getDataList();
      });
      EventBus.$on('updateProjectPartDocumentInfo', () => {
        this.getProofDocument()
      });
      EventBus.$on('updateThisProjectPartDocumentInfo', () => {
        this.searchProjectAllDocumentList()
      });
      EventBus.$on('getProjectOtherDocument', () => {
        this.getProjectOtherDocument()
      });
    },

    created () {
      // 按钮控制
      this.getButtonAuthData()
      // 获取用户的 site 和 bu
      this.getSiteAndBuByUserName()
      // 校验用户是否收藏
      this.favoriteIsOk()
      // 动态列
      this.getTableUserColumn(this.$route.meta.menuId+'table1',1)
      if (!this.authSearch) {
        if (!this.agencyMatters){
          if (this.$route.query.projectNo || this.$route.query.testPartNo) {
            this.searchData1.projectNo = this.$route.query.projectNo;
            this.searchData1.testPartNo = this.$route.query.testPartNo;
            this.agencyMatters = true;
          }
          // 获取 URL 查询参数
          const { projectPartId } = this.$route.query;
          // 将查询参数赋值给 searchData
          if (projectPartId){
            this.searchData.projectPartId = projectPartId
          }
          // 获取数据列表
          this.getDataList()
        }
      }
    },

    activated() {
      if (this.$route.query.projectNo || this.$route.query.testPartNo) {
        this.searchData1.projectNo = this.$route.query.projectNo;
        this.searchData1.testPartNo = this.$route.query.testPartNo;
        this.agencyMatters = true;
        this.getDataList();
      }
      this.$store.commit("sift/commitSearchFunction",this.queryEamProjectPart)
    },

    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 = ''
          if (val === 509 ) {
            strVal = this.modalData.customerNo
            this.$refs.baseList.init(val, strVal)
          }
          if (val === 301 ) {
            strVal = this.modalData.projectManager
            this.$refs.baseList.init(val, strVal)
          }
        })
      },

      /* 列表方法的回调 */
      getBaseData (val) {
        if (this.tagNo === 509) {
          this.modalData.customerNo = val.customer_no
          this.modalData.customerDesc = val.customer_desc
        }
      },

      // 校验用户是否收藏
      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 eamProjectPartSearch(this.searchData).then(({data}) => {
          this.exportList = data.page.list
          this.exportList.forEach((item) => {
            item.projectManagerName = item.projectManager.split('-')[1];
            item.projectOwnerName = item.projectOwner.split('-')[1];
            item.engineerName = item.engineer.split('-')[1];
            item.cQualityEngineer1Name = item.cQualityEngineer1.split('-')[1];
            item.cQualityEngineer2Name = item.cQualityEngineer2.split('-')[1];
            item.cQualityEngineer3Name = item.cQualityEngineer3.split('-')[1];
            item.cManufactureEngineerName = item.cManufactureEngineer.split('-')[1];
            if (item.cQualityEngineer4 !== null && item.cQualityEngineer4 !== '') {
              item.cQualityEngineer4Name = item.cQualityEngineer4.split('-')[1];
            }
            if (item.cQualityEngineer5 !== null && item.cQualityEngineer5 !== '') {
              item.cQualityEngineer5Name = item.cQualityEngineer5.split('-')[1];
            }
            if (item.cQualityEngineer6 !== null && item.cQualityEngineer6 !== '') {
              item.cQualityEngineer6Name = item.cQualityEngineer6.split('-')[1];
            }
            if (item.docEngineer !== null && item.docEngineer !== '') {
              item.docEngineerName = item.docEngineer.split('-')[1];
            }
          });

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

      // 获取数据列表
      getDataList (params) {
        this.selectTypeFlag = params
        this.searchData.limit = this.pageSize
        this.searchData.page = this.pageIndex
        this.searchData1.limit = this.pageSize
        this.searchData1.page = this.pageIndex
        if (this.agencyMatters) {
          eamProjectPartSearch(this.searchData1).then(({data}) => {
            if (data.code === 0) {
              this.dataList = data.page.list
              this.pageIndex = data.page.currPage
              this.pageSize = data.page.pageSize
              this.totalPage = data.page.totalCount
              // 遍历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]
                }
              })
              // 判断是否全部存在数据
              if (this.totalPage > 0) {
                // 设置选中行
                this.$refs.mainTable.setCurrentRow(this.dataList[this.dataListIndex])
                // 加载当前的页签的table
                this.refreshCurrentTabTable()
                this.proofingClickRow(this.dataList[this.dataListIndex])
                this.dataListIndex = 0
              }
            }
          })
        } else {
          eamProjectPartSearch(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]
                item.cManufactureEngineerName = item.cManufactureEngineer.split('-')[1]
                if (item.cQualityEngineer4 != null && item.cQualityEngineer4 !== ''){
                  item.cQualityEngineer4Name = item.cQualityEngineer4.split('-')[1]
                }
                if (item.cQualityEngineer5 != null && item.cQualityEngineer5 !== ''){
                  item.cQualityEngineer5Name = item.cQualityEngineer5.split('-')[1]
                }
                if (item.cQualityEngineer6 != null && item.cQualityEngineer6 !== ''){
                  item.cQualityEngineer6Name = item.cQualityEngineer6.split('-')[1]
                }
                if (item.docEngineer != null && item.docEngineer !== ''){
                  item.docEngineerName = item.docEngineer.split('-')[1]
                }
              })

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

              // 判断是否全部存在数据
              if (this.totalPage > 0) {
                // 设置选中行
                this.$refs.mainTable.setCurrentRow(this.dataList[this.dataListIndex])
                // 加载当前的页签的table
                this.refreshCurrentTabTable()
                this.proofingClickRow(this.dataList[this.dataListIndex])
                this.dataListIndex = 0
              }
            }
          })
        }
      },

      queryEamProjectPart (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
        }
        queryEamProjectPart(params).then(({data}) => {
          if (data.code === 0) {
            this.dataList = data.page.list
            this.pageIndex = data.page.currPage
            this.pageSize = data.page.pageSize
            this.totalPage = data.page.totalCount
            // 遍历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]
              item.cManufactureEngineerName = item.cManufactureEngineer.split('-')[1]
              if (item.cQualityEngineer4 != null && item.cQualityEngineer4 !== ''){
                item.cQualityEngineer4Name = item.cQualityEngineer4.split('-')[1]
              }
              if (item.cQualityEngineer5 != null && item.cQualityEngineer5 !== ''){
                item.cQualityEngineer5Name = item.cQualityEngineer5.split('-')[1]
              }
              if (item.cQualityEngineer6 != null && item.cQualityEngineer6 !== ''){
                item.cQualityEngineer6Name = item.cQualityEngineer6.split('-')[1]
              }
              if (item.docEngineer != null && item.docEngineer !== ''){
                item.docEngineerName = item.docEngineer.split('-')[1]
              }
            })

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

            // 判断是否全部存在数据
            if (this.totalPage > 0) {
              // 设置选中行
              this.$refs.mainTable.setCurrentRow(this.dataList[this.dataListIndex])
              // 加载当前的页签的table
              this.refreshCurrentTabTable()
              this.proofingClickRow(this.dataList[this.dataListIndex])
              this.dataListIndex = 0
            }
          }
        })
      },
      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();
        const finalPartNosMap = 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));
          }

          // Handle finalPartNos
          if (!finalPartNosMap.has(item.finalPartNo) && item.finalPartNo !== null) {
            const finalPartNoId = finalPartNosMap.size + 1;
            finalPartNosMap.set(item.finalPartNo, {
              finalPartNoId,
              finalPartNo: item.finalPartNo,
            });
            allPersonnelList.push(finalPartNosMap.get(item.finalPartNo));
          }

          // Handle cManufactureEngineer
          if (item.cManufactureEngineer !== null || item.cManufactureEngineer !== ''){
            if (!this.allMFGList.includes(item.cManufactureEngineer.split('-')[0])) {
              this.allMFGList.push(item.cManufactureEngineer.split('-')[0]);
            }
          }
        });

        this.allPersonnelInfoList = allPersonnelList;
      },

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

      generateNextPartNo() {
        return new Promise((resolve, reject) => {
          getTestPartNo().then(({ data }) => {
            const stringData = String(data); // 显式转换为字符串
            if (stringData === 'null' || stringData === 'undefined' || stringData === '' || stringData === '0') {
              resolve('P00001');
            } else {
              const lastPartNo = parseInt(stringData.substring(1));
              const nextPartNo = lastPartNo + 1;
              let testPartNo;

              if (nextPartNo < 10) {
                testPartNo = 'P0000' + nextPartNo;
              } else if (nextPartNo < 100) {
                testPartNo = 'P000' + nextPartNo;
              } else if (nextPartNo < 1000) {
                testPartNo = 'P00' + nextPartNo;
              } else if (nextPartNo < 10000) {
                testPartNo = 'P0' + nextPartNo;
              } else {
                testPartNo = 'P' + nextPartNo;
              }

              resolve(testPartNo);
            }
          }).catch(error => {
            reject('Failed to fetch testPartNo: ' + error);
          });
        });
      },
      changeFormalPartNo (row) {
        this.modalData = {
          flag: '2',
          site: row.site,
          bu: row.site + '_' + row.buNo,
          customerNo: row.customerNo,
          customerDesc: row.customerDesc,
          projectCategory: row.projectCategory,
          projectPartId: row.projectPartId,
          testPartNo: row.testPartNo,
          partDesc: row.partDesc,
          projectId: row.projectId,
          projectNo: row.projectNo,
          projectDesc: row.projectDesc,
          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], // 截取用户名
          projectCreationDate: row.projectCreationDate,
          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,
          finalPartNo: row.finalPartNo,
          finalPartDesc: row.finalPartDesc,
          // 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.getFinalPartDesc()
        this.formalPartNoFlag = true
      },
      addProofRecord (row) {
        this.newProofingRecordData = {
          site: row.site,
          buNo: row.buNo,
          projectId: row.projectId,
          projectNo: row.projectNo,
          projectDesc: row.projectDesc,
          customerNo: row.customerNo,
          customerDesc: row.customerDesc,
          bu: row.site + '_' + row.buNo,
          projectPartId: row.projectPartId,
          testPartNo: row.testPartNo,
          partDesc: row.partDesc,
          projectCategory: row.projectCategory,
          cProjectTypeDb: row.projectCategory,
          projectManager: row.projectManager,
          projectOwner: row.projectOwner,
          engineer: row.engineer,
          cQualityEngineer1: row.cQualityEngineer1,
          cQualityEngineer2: row.cQualityEngineer2,
          cQualityEngineer3: row.cQualityEngineer3,
          cQualityEngineer4: row.cQualityEngineer4,
          cQualityEngineer5: row.cQualityEngineer5,
          cQualityEngineer6: row.cQualityEngineer6,
          cManufactureEngineer: row.cManufactureEngineer,
          docEngineer: row.docEngineer,
          remark: '',
          planStartDate : new Date(),
          proofingNo: '',
          proofingStatus: '草稿',
          rrequiredDeliveryDate: '',
          createDate: '',
          createBy: this.$store.state.user.name,
        }
        this.visible = true
      },

      newProofingRecord() {
        if (this.newProofingRecordData.cProjectTypeDb === '' || this.newProofingRecordData.cProjectTypeDb === null || this.newProofingRecordData.cProjectTypeDb === undefined) {
          this.$message({
            message: '项目分类不能为空',
            type: 'warning'
          })
          return
        }
        if (this.newProofingRecordData.projectPhase === '' || this.newProofingRecordData.projectPhase === null || this.newProofingRecordData.projectPhase === undefined) {
          this.$message({
            message: '项目阶段不能为空',
            type: 'warning'
          })
          return
        }
        if (this.newProofingRecordData.proofingNo === '' || this.newProofingRecordData.proofingNo === null || this.newProofingRecordData.proofingNo === undefined) {
          this.$message({
            message: '打样单号不能为空',
            type: 'warning'
          })
          return
        }
        if (this.newProofingRecordData.proofingNumber === '' || this.newProofingRecordData.proofingNumber === null || this.newProofingRecordData.proofingNumber === undefined) {
          this.$message({
            message: '数量不能为空',
            type: 'warning'
          })
          return
        }
        // 数量必须是大于等于0的正整数
        if (!/^[1-9]\d*$/.test(this.newProofingRecordData.proofingNumber)) {
          this.$alert('数量必需是大于等于0的正整数', '提示', {
            confirmButtonText: '确定',
          });
          return
        }
        if (this.newProofingRecordData.planStartDate === '' || this.newProofingRecordData.planStartDate === null || this.newProofingRecordData.planStartDate === undefined) {
          this.$message({
            message: '打样开始日期不能为空',
            type: 'warning'
          })
          return
        }
        if (this.newProofingRecordData.requiredDeliveryDate === '' || this.newProofingRecordData.requiredDeliveryDate === null || this.newProofingRecordData.requiredDeliveryDate === undefined) {
          this.$message({
            message: '预计完成日期不能为空',
            type: 'warning'
          })
          return
        }
        proofingInformationSave(this.newProofingRecordData).then(({data}) => {
          //区分请求成功和失败的状况
          if (data && data.code === 0) {
            this.newProofingDocument(data.proofingId).then(() => {
              this.visible = false
              //刷新表格
              this.getRowProjectInfo()
            })
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        })
      },

      newProofingDocument(proofingId) {
        this.newProofingRecordData.proofingId = proofingId
        return proofingDocumentSave(this.newProofingRecordData).then(({ data }) => {
          if (data && data.code === 0) {
            this.$message({
              message: '新增成功',
              type: 'success'
            })
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        });
      },

      updateModalStatus (row) {
        this.modalData = {
          site: row.site,
          bu: row.site + '_' + row.buNo,
          username: this.$store.state.user.name,
          customerNo: row.customerNo,
          customerDesc: row.customerDesc,
          projectCategory: row.projectCategory,
          projectPartId: row.projectPartId,
          testPartNo: row.testPartNo,
          partDesc: row.partDesc,
          projectId: row.projectId,
          projectNo: row.projectNo,
          projectDesc: row.projectDesc,
          priority: row.priority,
          closeDate: 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,
          buildDate: 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] // 截取用户名
        }
        if (row.status === '草稿') {
          if (row.projectOwner.split('-')[0] === this.$store.state.user.name) {
            this.modalData.status = '进行中'
            this.$confirm(`是否确认下达该项目?`, '提示', {
              confirmButtonText: '确定',
              cancelButtonText: '取消',
              type: 'warning'
            }).then(() => {
              eamProjectPartInfoEdit(this.modalData).then(({data}) => {
                if (data && (data.code === 0 || data.code === '0')) {
                  sendMailHandle(this.modalData).then(({data}) => {
                    if (data && data.code === 0) {
                      this.$message({
                        message: '发送成功',
                        type: 'success'
                      })
                    } else {
                      this.$alert(data.msg, '错误', {
                        confirmButtonText: '确定'
                      })
                    }
                  })
                  EventBus.$emit('updateProjectInfo')
                  this.dataList.forEach((item) => {
                    if (item.projectPartId === row.projectPartId) {
                      this.dataListIndex = this.dataList.indexOf(item)
                    }
                  })
                  this.getDataList()
                  this.$message({
                    message: '操作成功',
                    type: 'success',
                    duration: 1500,
                    onClose: () => {
                    }
                  })
                } else {
                  this.$alert(data.msg, '错误', {
                    confirmButtonText: '确定'
                  })
                }
              })
            }).catch(() => {
            })
          } else {
            this.$message({
              message: '该项目只允许PjM人员进行下达！',
              type: 'warning',
              showClose: true, // 显示关闭按钮
              duration: 2000 // 显示时间，单位是毫秒，这里设置为5秒钟
            });
          }
        } else if (row.status === '进行中' || '已量产') {
          if (row.status === '进行中') {
            this.modalData.status2 = '进行中'
          }
          this.modalData.status = '已量产'
          this.modalData.closeDate = new Date()
          this.$confirm(`是否确认转量产?`, '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            eamProjectPartInfoEdit(this.modalData).then(({data}) => {
              if (data && ( data.code === 0 || data.code === '0')) {
                this.getDataList()
                EventBus.$emit('updateProjectInfo')
                this.$message({
                  message: '操作成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {}
                })
              } else {
                this.$alert(data.msg, '错误', {
                  confirmButtonText: '确定'
                })
              }
            })
          }).catch(() => {
          })
        }
      },
      sendMassMailHandle () {
        let inData = this.proofingCurrentRow
        inData.proofingId = -1
        sendMailHandle(inData).then(({data}) => {
          if (data && data.code === 0) {
            this.$message({
              message: '发送成功',
              type: 'success'
            })
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        })
      },
      getRowProjectInfo(){
        let inData={
          site: this.proofingCurrentRow.site,
          projectId: this.proofingCurrentRow.projectId,
          projectPartId: this.proofingCurrentRow.projectPartId,
          projectManager: this.proofingCurrentRow.projectManager,
          projectOwner: this.proofingCurrentRow.projectOwner,
          engineer: this.proofingCurrentRow.engineer,
          cQualityEngineer1: this.proofingCurrentRow.cQualityEngineer1,
          cQualityEngineer2: this.proofingCurrentRow.cQualityEngineer2,
          cQualityEngineer3: this.proofingCurrentRow.cQualityEngineer3,
          cQualityEngineer4: this.proofingCurrentRow.cQualityEngineer4,
          cQualityEngineer5: this.proofingCurrentRow.cQualityEngineer5,
          cQualityEngineer6: this.proofingCurrentRow.cQualityEngineer6,
          cManufactureEngineer: this.proofingCurrentRow.cManufactureEngineer,
          docEngineer: this.proofingCurrentRow.docEngineer,
          // username:this.$store.state.user.name,
          page: 1,
          limit: 1000
        }
        this.$refs.proofRecord.init(inData)
      },
      editProjectDocument(modalData) {
        modalData.buNo = modalData.bu.split('_')[1]
        modalData.proofingId = -1
        editProjectDocument(modalData).then(({data}) => {
          //区分请求成功和失败的状况
          if (data && data.code === 0) {
            this.$message({
              message: '编辑成功',
              type: 'success'
            })
            //刷新表格
            this.refreshCurrentTabTable()
          }
        })
      },

      getFinalPartDesc(){
        return new Promise((resolve, reject) => {
          let inData = {
            site: this.modalData.site,
            buNo: this.modalData.bu.split('_')[1],
            finalPartNo: this.modalData.finalPartNo,
          }
          getFinalPartDesc(inData).then(({data}) => {
            if (data && data.code === 0) {
              if (data.data !== null) {
                this.modalData.finalPartDesc = data.data.finalPartDesc
                this.finalPartFlag = false
              } else {
                this.modalData.finalPartDesc = ''
                this.finalPartFlag = true
              }
            } else {
              this.modalData.finalPartDesc = ''
            }
            resolve(); // 在操作成功时解析Promise
          }).catch(error => {
            this.modalData.finalPartDesc = '';
            reject(error); // 如果发生错误，拒绝Promise
          });
        });
      },

      async saveFormalPartNo() {
        try {
          await this.getFinalPartDesc();
        } catch (error) {
          // 处理getFinalPartDesc方法中的错误
          console.error("Error in getFinalPartDesc:", error);
          this.$message({
            message: '获取料号描述时发生错误，请重试',
            type: 'error'
          });
        }
        if (this.modalData.finalPartNo === '' || this.modalData.finalPartNo === null || this.modalData.finalPartNo === undefined) {
          this.$message({
            message: '请输入ERP正式料号',
            type: 'warning'
          })
          return
        }
        if (this.finalPartFlag) {
          this.$confirm('ERP正式料号不存在，是否继续保存?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            saveFormalPartNo(this.modalData).then(({data}) => {
              if (data && data.code === '0') {
                this.getDataList()
                this.formalPartNoFlag = false
                this.$message({
                  message: '操作成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {
                  }
                })
              } else {
                this.$alert(data.msg, '错误', {
                  confirmButtonText: '确定'
                })
              }
            })
          }).catch(() => {
            this.$message({
              type: 'info',
              message: '已取消操作'
            })
          })
        } else {
          saveFormalPartNo(this.modalData).then(({data}) => {
            if (data && data.code === '0') {
              this.getDataList()
              this.formalPartNoFlag = false
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {
                }
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        }
      },

      selectFlag () {
        return true
      },

      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.projectCreationDate = new Date()
      },
      projectOtherDocumentClickRow (row) {
        row.id = row.documentDefinitionListId
        this.otherDocumentCurrentRow = JSON.parse(JSON.stringify(row))
      },
      changeCurrentRow1 (row, oldRow) {
        row.id = row.documentDefinitionListId
        // 判断是否是获取焦点的事件
        if (row) {
          this.otherDocumentCurrentRow.bu = this.otherDocumentCurrentRow.site + "-" + this.otherDocumentCurrentRow.buNo
          this.otherDocumentCurrentRow = JSON.parse(JSON.stringify(row))
        }
      },
      projectAllDocumentClickRow (row) {
        row.id = row.documentDefinitionListId
        this.projectAllDocumentCurrentRow = JSON.parse(JSON.stringify(row))
      },
      /**
       * 上传文件
       */
      uploadFile () {
        this.isEditable = false;
        this.fileList = []
        this.proofingCurrentRow.proofingId= -1
        this.proofingCurrentRow.proofingNo = '*'
        this.uploadDialog = true
      },

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

      getProofDocument(row){
        let inData = {}
        if (row){
          inData = {
            site: this.$store.state.user.site,
            buNo: this.proofingCurrentRow.buNo,
            projectId: row.projectId,
            projectPartId: this.proofingCurrentRow.projectPartId,
            proofingId: row.proofingId,
            userId: this.$store.state.user.id,
            languageCode: this.$i18n.locale
          }
        } else {
          inData = {
            site: this.proofingCurrentRow.site,
            buNo: this.proofingCurrentRow.buNo,
            projectId: this.proofingCurrentRow.projectId,
            projectNo: this.proofingCurrentRow.projectNo,
            projectDesc: this.proofingCurrentRow.projectDesc,
            projectPartId: this.proofingCurrentRow.projectPartId,
            testPartNo: this.proofingCurrentRow.testPartNo,
            partDesc: this.proofingCurrentRow.partDesc,
            customerId: this.proofingCurrentRow.customerNo,
            customerDesc: this.proofingCurrentRow.customerDesc,
            page: 1,
            limit: 1000
          }
        }
        getProofDocument(inData).then(({data}) => {
          if (row){
            if (data && data.code === 0) {
              this.projectPartDocumentList = data.page.list
              for (let i = 0; i < this.projectPartDocumentList.length; i++) {
                if (this.projectPartDocumentList[i].responsibleDepartment === 'PM/Sales'){
                  this.projectPartDocumentList[i].projectLeader = this.proofingCurrentRow.projectManager.split("-")[1]
                } else if(this.projectPartDocumentList[i].responsibleDepartment === 'PjM'){
                  this.projectPartDocumentList[i].projectLeader = this.proofingCurrentRow.projectOwner.split("-")[1]
                } else if(this.projectPartDocumentList[i].responsibleDepartment === 'Engineer'){
                  this.projectPartDocumentList[i].projectLeader = this.proofingCurrentRow.engineer.split("-")[1]
                } else if(this.projectPartDocumentList[i].responsibleDepartment === 'IPQC-Lam/Pri/Etch/Slit'){
                  this.projectPartDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer1.split("-")[1]
                } else if(this.projectPartDocumentList[i].responsibleDepartment === 'IPQC-Converting'){
                  this.projectPartDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer2.split("-")[1]
                } else if(this.projectPartDocumentList[i].responsibleDepartment === 'FQC1'){
                  this.projectPartDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer3.split("-")[1]
                } else if(this.projectPartDocumentList[i].responsibleDepartment === 'MFQ'){
                  this.projectPartDocumentList[i].projectLeader = this.proofingCurrentRow.cManufactureEngineer.split("-")[1]
                }else if (this.projectPartDocumentList[i].responsibleDepartment === 'SQE') {
                  if (this.proofingCurrentRow.cQualityEngineer4 != null && this.proofingCurrentRow.cQualityEngineer4 !== '') {
                    this.projectPartDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer4.split('-')[1] // 截取用户名
                  }
                }
                else if (this.projectPartDocumentList[i].responsibleDepartment === 'FQC2') {
                  if (this.proofingCurrentRow.cQualityEngineer5 != null && this.proofingCurrentRow.cQualityEngineer5 !== '') {
                    this.projectPartDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer5.split('-')[1] // 截取用户名
                  }
                }
                else if (this.projectPartDocumentList[i].responsibleDepartment === 'IQC') {
                  if (this.proofingCurrentRow.cQualityEngineer6 != null && this.proofingCurrentRow.cQualityEngineer6 !== '') {
                    this.projectPartDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer6.split('-')[1] // 截取用户名
                  }
                }
                else if(this.projectPartDocumentList[i].responsibleDepartment === 'DocEngineer'){
                  if (this.proofingCurrentRow.docEngineer != null && this.proofingCurrentRow.docEngineer !== ''){
                    this.projectPartDocumentList[i].projectLeader= this.proofingCurrentRow.docEngineer.split('-')[1] // 截取用户名
                  }
                }
                this.projectPartDocumentList[i].buNo = inData.buNo
              }
            }
          } else {
            if (data && data.code === 0) {
              this.proofDocumentList = data.page.list
              for (let i = 0; i < this.proofDocumentList.length; i++) {
                this.proofDocumentList[i].buNo = this.proofingCurrentRow.buNo
              }
            } else {
              this.proofDocumentList = []
            }
          }
        })
      },
      uploadOtherDocument () {
        this.isEditable = true;
        this.fileList = []
        this.otherDocumentCurrentRow = {
          proofingId: -1,
          documentTypeId: '', // 清空文档类型ID
          id: '-1'
        };
        this.uploadDialog = true
        //打开组件 去做新增业务
        // this.$nextTick(() => {
        //   this.$refs.partUploadFile.init(currentData);
        // })
      },
      massProductionDocumentDelete(row) {
        let tempData = {
          site: row.site,
          username: this.$store.state.user.name,
          buNo: row.buNo,
          proofingNo: row.proofingNo,
          projectId: row.projectId,
          projectNo: row.projectNo,
          projectDesc: row.projectDesc,
          customerId: row.customerNo,
          customerDesc: row.customerDesc,
          projectPartId: this.proofingCurrentRow.projectPartId,
          testPartNo: this.proofingCurrentRow.testPartNo,
          partDesc: row.partDesc,
          id: row.id,
          fileName: row.fileName,
          uploadedFlag: row.uploadedFlag,
          cAdditionalInfo: row.cAdditionalInfo,
          createBy: row.createdBy,
          documentDefinitionListId: row.documentDefinitionListId,
          documentType: row.documentType,
          documentId: row.documentId,
        }
        if (tempData.createBy !== tempData.username) {
          this.$message({
            message: '只能删除自己创建的打样记录',
            type: 'warning'
          })
        }else {
          this.$confirm('是否删除该转量产阶段文档的文件?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            deleteProofDocument(tempData).then(({data}) => {
              if (data && data.code === 0) {
                this.$message({
                  message: '删除成功',
                  type: 'success'
                })
                //刷新表格
                this.getProjectOtherDocument()
                this.getProofDocument()
              }
              // 否则提示后端返回的错误信息
              else {
                this.$alert(data.msg, '错误', {
                  confirmButtonText: '确定'
                })
              }
            })
          }).catch(() => {
            this.$message({
              type: 'info',
              message: '已取消删除'
            });
          });
        }
      },
      getProjectOtherDocument () {
        let tempData = {
          site: this.$store.state.user.site,
          username: this.$store.state.user.name,
          buNo: this.proofingCurrentRow.buNo,
          proofingId: -1,
          projectId: this.proofingCurrentRow.projectId,
          projectNo: this.proofingCurrentRow.projectNo,
          projectDesc: this.proofingCurrentRow.projectDesc,
          projectPartId: this.proofingCurrentRow.projectPartId,
          testPartNo: this.proofingCurrentRow.testPartNo,
          partDesc: this.proofingCurrentRow.partDesc,
          customerId: this.proofingCurrentRow.customerNo,
          customerDesc: this.proofingCurrentRow.customerDesc,
          page: 1,
          limit: -1
        }
        getProjectOtherDocument(tempData).then(({data}) => {
          if (data && data.code === 0) {
            this.projectOtherDocumentList = data.page.list
            this.proofDocumentListDefinition = []
            // 遍历proofDocumentList
            for (let i = 0; i < this.projectOtherDocumentList.length; i++) {
              this.projectOtherDocumentList[i].buNo = this.proofingCurrentRow.buNo
              if (this.projectOtherDocumentList[i].documentTypeId !== 'N/A') {
                this.proofDocumentListDefinition.push(this.projectOtherDocumentList[i])
              }
              if (this.projectOtherDocumentList[i].responsibleDepartment === 'PM/Sales') {
                this.projectOtherDocumentList[i].projectLeader = this.proofingCurrentRow.projectManager.split("-")[1]
              } else if (this.projectOtherDocumentList[i].responsibleDepartment === 'PjM') {
                this.projectOtherDocumentList[i].projectLeader = this.proofingCurrentRow.projectOwner.split("-")[1]
              } else if (this.projectOtherDocumentList[i].responsibleDepartment === 'Engineer') {
                this.projectOtherDocumentList[i].projectLeader = this.proofingCurrentRow.engineer.split("-")[1]
              } else if (this.projectOtherDocumentList[i].responsibleDepartment === 'IPQC-Lam/Pri/Etch/Slit') {
                this.projectOtherDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer1.split("-")[1]
              } else if (this.projectOtherDocumentList[i].responsibleDepartment === 'IPQC-Converting') {
                this.projectOtherDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer2.split("-")[1]
              } else if (this.projectOtherDocumentList[i].responsibleDepartment === 'FQC1') {
                this.projectOtherDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer3.split("-")[1]
              } else if (this.projectOtherDocumentList[i].responsibleDepartment === 'MFQ') {
                this.projectOtherDocumentList[i].projectLeader = this.proofingCurrentRow.cManufactureEngineer.split("-")[1]
              } else if (this.projectOtherDocumentList[i].responsibleDepartment === 'SQE') {
                if (this.proofingCurrentRow.cQualityEngineer4 != null && this.proofingCurrentRow.cQualityEngineer4 !== '') {
                  this.projectOtherDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer4.split('-')[1] // 截取用户名
                }
              } else if (this.projectOtherDocumentList[i].responsibleDepartment === 'FQC2') {
                if (this.proofingCurrentRow.cQualityEngineer5 != null && this.proofingCurrentRow.cQualityEngineer5 !== '') {
                  this.projectOtherDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer5.split('-')[1] // 截取用户名
                }
              } else if (this.projectOtherDocumentList[i].responsibleDepartment === 'IQC') {
                if (this.proofingCurrentRow.cQualityEngineer6 != null && this.proofingCurrentRow.cQualityEngineer6 !== '') {
                  this.projectOtherDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer6.split('-')[1] // 截取用户名
                }
              } else if (this.projectOtherDocumentList[i].responsibleDepartment === 'DocEngineer') {
                if (this.proofingCurrentRow.docEngineer != null && this.proofingCurrentRow.docEngineer !== '') {
                  this.projectOtherDocumentList[i].projectLeader = this.proofingCurrentRow.docEngineer.split('-')[1] // 截取用户名
                }
              }
            }
          } else {
            this.projectOtherDocumentList = []
          }
        })
      },
      getColumnValue(row, column) {
        // 根据列的配置信息决定显示的值
        if (column.columnProp === 'documentType') {
          return this.getCombinedDocumentType(row);
        }
        else if (column.columnProp === 'documentDesc') {
          return row.documentDesc; // 或者根据实际需求处理其他字段的显示
        }
        else {
          return row[column.columnProp]; // 默认返回对应列的值
        }
      },
      getCombinedDocumentType(row) {
        // 根据您的需求，组合或拼接需要显示的字段
        if (row.documentType === null || row.documentType === undefined) {
          return row.documentDesc
        }else {
          return row.documentType
        }
      },
      // 动态列开始 获取 用户保存的 格式列
      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.detailColumnList = data.rows
              //   break;
              // case 3:
              //   this.columnList2 = data.rows
              //   break;
              // case 4:
              //   this.columnList3 = data.rows
              //   break;
            }
          } else {
            this.getColumnList(tableId, columnId)
          }
        })
      },
      projectDocumentList () {
        this.modalData = {
          site: this.proofingCurrentRow.site,
          buNo: this.proofingCurrentRow.buNo,
          projectId: this.proofingCurrentRow.projectId,
          projectNo: this.proofingCurrentRow.projectNo,
          projectDesc: this.proofingCurrentRow.projectDesc,
          customerNo: this.proofingCurrentRow.customerNo,
          customerDesc: this.proofingCurrentRow.customerDesc,
          bu: this.proofingCurrentRow.site + '_' + this.proofingCurrentRow.buNo,
          testPartNo: this.proofingCurrentRow.testPartNo,
          partDesc: this.proofingCurrentRow.partDesc,
          projectCategory: this.proofingCurrentRow.projectCategory,
          cProjectTypeDb: this.proofingCurrentRow.projectCategory,
          proofingNo: '*',
          proofingId: -1,
          rrequiredDeliveryDate: '',
          createDate: new Date(),
          createBy: this.$store.state.user.name,
          limit: 1000,
          page: 1
        }
        this.getProjectOtherDocument()
        this.projectDocumentListVisible = true
      },
      projectDocumentListVisibleFalse() {
        this.projectDocumentListVisible = false
        this.proofDocumentListDefinition = []
      },
      deleteProjectDocumentType(row) {
        this.$confirm('是否删除该文档清单?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          deleteDocumentType(row).then(({data}) => {
            if (data && data.code === 0) {
              this.$message({
                message: '删除成功',
                type: 'success',
              })
              this.getProjectOtherDocument()
              this.getProofDocument()
            } else {
              this.$alert(data.msg, '错误', {
                    confirmButtonText: '确定'
                  })
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消删除'
          });
        });
      },
      closeAddProjectDocumentTypeFlag() {
        this.addProjectDocumentTypeFlag = false
        this.searchProjectDocumentTypeData = {
          site: this.$store.state.user.site,
          projectNo: '',
          proofingNo: '*',
          documentTypeId: '',
          documentType: '',
          responsibleDepartment: '',
          estimatedCompletionDays: '',
          page: 1,
          limit: 1000
        }
        this.extraProjectDocumentList = []
      },
      filteredProjectAllDocumentList() {
        this.projectAllDocumentList.map(item => {
          item.id = item.documentDefinitionListId
        })
        return this.projectAllDocumentList.filter(item => item.uploadedFlag !== 'N')
      },
      searchProjectDocumentTypeList() {
        this.searchProjectDocumentTypeData.proofingNo = '*'
        this.searchProjectDocumentTypeData.projectNo = this.modalData.projectNo
        getExtraDocumentList(this.searchProjectDocumentTypeData).then(({data}) => {
          if (data && data.code === 0) {
            this.extraProjectDocumentList = data.page.list
          } else {
            this.extraProjectDocumentList = []
          }
        })
      },
      selectionProjectDocument(val) {
        this.projectDocumentSelection = val
      },
      saveSelectionProjectDocumentType() {
        if (this.projectDocumentSelection.length === 0) {
          this.$message({
            message: '请选择文档类型',
            type: 'error'
          })
          this.extraProjectDocumentList = []
          return
        }
        this.projectDocumentSelection.forEach((item) => {
          const inData = {
            site: this.$store.state.user.site,
            proofingId: -1,
            proofingNo: '*',
            projectId: this.proofingCurrentRow.projectId,
            projectNo: this.modalData.projectNo,
            projectPartId: this.proofingCurrentRow.projectPartId,
            testPartNo: this.modalData.testPartNo,
            documentTypeId: item.documentTypeId,
            documentType: item.documentType,
            responsibleDepartment: item.responsibleDepartment,
            estimatedCompletionDays: item.estimatedCompletionDays,
            createBy: this.$store.state.user.name,
          }
          proofingDocumentNEW(inData).then(({data}) => {
            //区分请求成功和失败的状况
            if (data && data.code === 0) {
              this.$message({
                message: '新增成功',
                type: 'success'
              })
              this.addProjectDocumentTypeFlag = false
              //刷新表格
              this.refreshCurrentTabTable()
            } else {
              this.$message({
                message: '新增失败',
                type: 'error'
              })
            }
          })
        })
      },
      searchProjectAllDocumentList () {
        let inData = {
          site: this.$store.state.user.site,
          username: this.$store.state.user.name,
          buNo: this.proofingCurrentRow.buNo,
          proofingId: -999,
          projectId: this.proofingCurrentRow.projectId,
          projectNo: this.proofingCurrentRow.projectNo,
          projectDesc: this.proofingCurrentRow.projectDesc,
          projectPartId: this.proofingCurrentRow.projectPartId,
          testPartNo: this.proofingCurrentRow.testPartNo,
          partDesc: this.proofingCurrentRow.partDesc,
          customerId: this.proofingCurrentRow.customerNo,
          customerDesc: this.proofingCurrentRow.customerDesc,
          page: 1,
          limit: 1000
        }
        searchProjectAllDocument(inData).then(({data}) => {
          if (data && data.code === 0){
            this.projectAllDocumentList = data.page.list;
            for (let i = 0; i < this.projectAllDocumentList.length; i++) {
              if (this.projectAllDocumentList[i].responsibleDepartment === 'PM/Sales'){
                this.projectAllDocumentList[i].projectLeader = this.proofingCurrentRow.projectManager.split("-")[1]
              } else if(this.projectAllDocumentList[i].responsibleDepartment === 'PjM'){
                this.projectAllDocumentList[i].projectLeader = this.proofingCurrentRow.projectOwner.split("-")[1]
              } else if(this.projectAllDocumentList[i].responsibleDepartment === 'Engineer'){
                this.projectAllDocumentList[i].projectLeader = this.proofingCurrentRow.engineer.split("-")[1]
              } else if(this.projectAllDocumentList[i].responsibleDepartment === 'IPQC-Lam/Pri/Etch/Slit'){
                this.projectAllDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer1.split("-")[1]
              } else if(this.projectAllDocumentList[i].responsibleDepartment === 'IPQC-Converting'){
                this.projectAllDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer2.split("-")[1]
              } else if(this.projectAllDocumentList[i].responsibleDepartment === 'FQC1'){
                this.projectAllDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer3.split("-")[1]
              } else if(this.projectAllDocumentList[i].responsibleDepartment === 'MFQ'){
                this.projectAllDocumentList[i].projectLeader = this.proofingCurrentRow.cManufactureEngineer.split("-")[1]
              } else if (this.projectAllDocumentList[i].responsibleDepartment === 'SQE') {
                if (this.proofingCurrentRow.cQualityEngineer4 != null && this.proofingCurrentRow.cQualityEngineer4 !== '') {
                  this.projectAllDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer4.split('-')[1] // 截取用户名
                }
              } else if (this.projectAllDocumentList[i].responsibleDepartment === 'FQC2') {
                if (this.proofingCurrentRow.cQualityEngineer5 != null && this.proofingCurrentRow.cQualityEngineer5 !== '') {
                  this.projectAllDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer5.split('-')[1] // 截取用户名
                }
              }
              else if (this.projectAllDocumentList[i].responsibleDepartment === 'IQC') {
                if (this.proofingCurrentRow.cQualityEngineer6 != null && this.proofingCurrentRow.cQualityEngineer6 !== '') {
                  this.projectAllDocumentList[i].projectLeader = this.proofingCurrentRow.cQualityEngineer6.split('-')[1] // 截取用户名
                }
              }
              else if (this.projectAllDocumentList[i].responsibleDepartment === 'DocEngineer'){
                if (this.proofingCurrentRow.docEngineer != null && this.proofingCurrentRow.docEngineer !== ''){
                  this.projectAllDocumentList[i].projectLeader= this.proofingCurrentRow.docEngineer.split('-')[1] // 截取用户名
                }
              }
            }
          }
        })
      },
      projectProductionValidationDocument () {
        this.modalData = {
          site: this.proofingCurrentRow.site,
          buNo: this.proofingCurrentRow.buNo,
          projectId: this.proofingCurrentRow.projectId,
          projectNo: this.proofingCurrentRow.projectNo,
          projectDesc: this.proofingCurrentRow.projectDesc,
          customerNo: this.proofingCurrentRow.customerNo,
          customerDesc: this.proofingCurrentRow.customerDesc,
          bu: this.proofingCurrentRow.site + '_' + this.proofingCurrentRow.buNo,
          testPartNo: this.proofingCurrentRow.testPartNo,
          partDesc: this.proofingCurrentRow.partDesc,
          projectCategory: this.proofingCurrentRow.projectCategory,
          cProjectTypeDb: this.proofingCurrentRow.projectCategory,
          proofingNo: 'ALL',
          requiredDeliveryDate: '',
          // new Date() GMT+8
          wantedConfirmDate: new Date(),
          createDate: new Date(),
          createBy: this.$store.state.user.name,
          limit: 1000,
          page: 1
        }
        this.projectProductionValidationDocumentVisible = true
        this.projectAllDocumentList1 = this.filteredProjectAllDocumentList()
      },
      handleDocumentSelectionChange(val) {
        // 文档选择页签中选中数据发生变化时的处理
        val.forEach(item => {
          item.projectId = this.proofingCurrentRow.projectId
          item.projectPartId = this.proofingCurrentRow.projectPartId
          item.testPartNo = this.proofingCurrentRow.testPartNo
        })
        this.selectedDocumentItems = val;
      },
      searchConfirmatorList() {
        let inData = {
          site: this.proofingCurrentRow.site,
          buNo: this.proofingCurrentRow.buNo,
          username: this.confirmatoryData.username,
          userDisplay: this.confirmatoryData.userDisplay,
          proofingNo: 'ALL',
          projectId: this.proofingCurrentRow.projectId,
          projectNo: this.proofingCurrentRow.projectNo,
          projectDesc: this.proofingCurrentRow.projectDesc,
          testPartNo: this.proofingCurrentRow.testPartNo,
          partDesc: this.proofingCurrentRow.partDesc,
          customerId: this.proofingCurrentRow.customerNo,
          customerDesc: this.proofingCurrentRow.customerDesc,
          page: 1,
          limit: 1000
        }
        searchConfirmatorList(inData).then(({data}) => {
          if (data && data.code === 0){
            this.projectAllDocumentConfirmatorList = data.page.list;
            this.projectANotDocumentConfirmatorList = data.list;
          }
        })
      },
      //可选人员
      confirmatoryClickRow1(row) {
        this.$refs.confirmatoryTable1.toggleRowSelection(row);
      },
      //已选人员
      confirmatoryClickRow2(row) {
        this.$refs.confirmatoryTable2.toggleRowSelection(row);
      },
      selectionConfirmatory1(val) {
        this.confirmatorySelection1 = val
      },
      selectionConfirmatory2(val) {
        this.confirmatorySelection2 = val
      },
      addConfirmatory() {
        if (this.confirmatorySelection1.length === 0) {
          this.$message.warning('请选择可选用户！')
          return
        }
        let inData = {
          site: this.proofingCurrentRow.site,
          buNo: this.proofingCurrentRow.buNo,
          confirmatoryList: this.confirmatorySelection1,
          createBy: this.$store.state.user.name
        }
        addConfirmatory(inData).then(({data}) => {
          if (data && data.code === 0) {
            this.searchConfirmatorList()
            this.businessRoleSelections1 = []
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        })
      },
      deleteConfirmatory() {
        if (this.confirmatorySelection2.length === 0) {
          this.$message.warning('请选择已选用户！')
          return
        }
        let inData = {
          site: this.proofingCurrentRow.site,
          buNo: this.proofingCurrentRow.buNo,
          confirmatoryList: this.confirmatorySelection2,
          createBy: this.$store.state.user.name
        }
        deleteConfirmatory(inData).then(({data}) => {
          if (data && data.code === 0) {
            this.searchConfirmatorList()
            this.businessRoleSelections2 = []
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        })
      },
      saveProductionValidationDocument() {
        if (this.selectedDocumentItems.length === 0) {
          this.$message({
            message: '请选择文档',
            type: 'warning',
            duration: 2000
          })
          return
        }else {
          this.$confirm('是否确认新增生产文档并向确认人员推送信息?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            this.projectAllDocumentConfirmatorList.map(item => {
              item.site = this.proofingCurrentRow.site;
              item.projectId = this.proofingCurrentRow.projectId;
              item.projectNo = this.proofingCurrentRow.projectNo;
              item.orderRef1 = this.proofingCurrentRow.projectId;
              item.orderRef2 = this.proofingCurrentRow.projectPartId;
              item.projectPartId = this.proofingCurrentRow.projectPartId;
              item.testPartNo = this.proofingCurrentRow.testPartNo;
              item.partDesc = this.proofingCurrentRow.partDesc;
              item.itemNo = this.projectAllDocumentConfirmatorList.indexOf(item) + 1;
              item.wantedConfirmDate = new Date(this.modalData.wantedConfirmDate.getTime() + 8 * 60 * 60 * 1000);
              item.createBy = this.$store.state.user.name;
              item.selectedDocumentItems = this.selectedDocumentItems;
            })
            checkProductionValidationDocument(this.projectAllDocumentConfirmatorList)
              .then(({ data }) => {
                if (data) {
                  this.$confirm('该项目已存在生产确认记录或已经有人员进行了确认，是否删除重新推送确认信息？', '提示', {
                    confirmButtonText: '是',
                    cancelButtonText: '否',
                    type: 'warning'
                  }).then(() => {
                      deleteAndSaveHandle(this.projectAllDocumentConfirmatorList).then(({data}) => {
                        if (data && data.code === 0) {
                          this.$message({
                            message: '操作成功',
                            type: 'success'
                          })
                          this.confirmatorSendMailHandle(this.projectAllDocumentConfirmatorList.at(0))
                          this.projectProductionValidationDocumentVisible = false
                        } else {
                          this.$alert("操作失败，请检查确认人员和确认文档或联系管理员！（" + data.msg + ")", '错误', {
                            confirmButtonText: '确定'
                          })
                        }
                      })
                  }).catch(() => {
                    this.$message({
                      type: 'info',
                      message: '已取消操作'
                    });
                  });
                } else {
                  saveHandle(this.projectAllDocumentConfirmatorList).then(({data}) => {
                    if (data && data.code === 0) {
                      this.$message({
                        message: '操作成功',
                        type: 'success'
                      })
                      this.confirmatorSendMailHandle(this.projectAllDocumentConfirmatorList.at(0))
                      this.projectProductionValidationDocumentVisible = false
                    } else {
                      this.$alert("操作失败，请检查确认人员和确认文档或联系管理员！（" + data.msg + ")", '错误', {
                        confirmButtonText: '确定'
                      })
                    }
                  })
                }
            });
          }).catch(() => {
            this.$message({
              type: 'info',
              message: '已取消操作'
            });
          });
        }
      },


      getConfirmProgressDocumentList() {
        let inData = {
          site: this.proofingCurrentRow.site,
          orderRef1: this.proofingCurrentRow.projectId,
          orderRef2: this.proofingCurrentRow.projectPartId,
          page: 1,
          limit: 1000
        }
        searchConfirmProgressDocumentList(inData).then(({data}) => {
          if (data && data.code === 0){
            this.confirmProgressDocumentList = data.page.list;
          }
        })
      },
      getConfirmProgressPusherList() {
        return new Promise((resolve, reject) => {
          let inData = {
            site: this.proofingCurrentRow.site,
            orderRef1: this.proofingCurrentRow.projectId,
            orderRef2: this.proofingCurrentRow.projectPartId,
            page: 1,
            limit: 1000
          };

          searchConfirmProgressPusherList(inData).then(({ data }) => {
            if (data && data.code === 0) {
              this.confirmProgressPusherList = data.page.list;
              resolve(); // 成功时调用 resolve
            } else {
              reject(new Error(data.msg)); // 处理错误
            }
          }).catch(error => {
            reject(error); // 处理请求错误
          });
        });
      } ,
      confirmDocument(row) {
        // 将this.$store.state.user.id转为字符串
        let userId = this.$store.state.user.id.toString()
        if (row.userid !== userId) {
          // 提示指定确认人为row.confirmedBy,是否继续
          this.$confirm('指定确认人为' + row.userDisplay + '，是否继续确认？', '提示', {
            confirmButtonText: '是',
            cancelButtonText: '否',
            type: 'warning'
          })
            .then(() => {
              this.confirmData = {
                site: row.site,
                documentType: row.documentType,
                orderRef1: row.orderRef1,
                orderRef2: row.orderRef2,
                itemNo: row.itemNo,
                userid: row.userid,
                username: row.username,
                userDisplay: row.userDisplay,
                wantedConfirmDate: row.wantedConfirmDate,
                confirmFlag: row.confirmFlag,
                confirmedDate: new Date(),
                createBy: row.createBy,
                createDate: row.createDate,
                confirmedBy: this.$store.state.user.userDisplay,
                documentId: row.documentId,
                remark: row.remark
              }
              this.modalData = {
                site: this.proofingCurrentRow.site,
                projectId: this.proofingCurrentRow.projectId,
                projectNo: this.proofingCurrentRow.projectNo,
                projectDesc: this.proofingCurrentRow.projectDesc,
                projectPartId: this.proofingCurrentRow.projectPartId,
                testPartNo: this.proofingCurrentRow.testPartNo,
                partDesc: this.proofingCurrentRow.partDesc,
                customerNo: this.proofingCurrentRow.customerNo,
                customerDesc: this.proofingCurrentRow.customerDesc,
                buNo: this.proofingCurrentRow.buNo,
                bu: this.proofingCurrentRow.site + '_' + this.proofingCurrentRow.buNo,
                cProjectTypeDb: this.proofingCurrentRow.projectCategory,
              }
              this.getProjectConfirmatorFileList(row)
              this.confirmVisible = true
            })
            .catch(() => {
              this.$message({
                type: 'info',
                message: '已取消操作'
              });
            });
        }else {
          this.confirmData = {
            site: row.site,
            documentType: row.documentType,
            orderRef1: row.orderRef1,
            orderRef2: row.orderRef2,
            itemNo: row.itemNo,
            userid: row.userid,
            username: row.username,
            userDisplay: row.userDisplay,
            wantedConfirmDate: row.wantedConfirmDate,
            confirmFlag: row.confirmFlag,
            confirmedDate: new Date(),
            createBy: row.createBy,
            createDate: row.createDate,
            confirmedBy: this.$store.state.user.name,
            documentId: row.documentId,
            remark: row.remark
          }
          this.modalData = {
            site: this.proofingCurrentRow.site,
            projectId: this.proofingCurrentRow.projectId,
            projectNo: this.proofingCurrentRow.projectNo,
            projectDesc: this.proofingCurrentRow.projectDesc,
            projectPartId: this.proofingCurrentRow.projectPartId,
            testPartNo: this.proofingCurrentRow.testPartNo,
            partDesc: this.proofingCurrentRow.partDesc,
            customerNo: this.proofingCurrentRow.customerNo,
            customerDesc: this.proofingCurrentRow.customerDesc,
            buNo: this.proofingCurrentRow.buNo,
            bu: this.proofingCurrentRow.site + '_' + this.proofingCurrentRow.buNo,
            cProjectTypeDb: this.proofingCurrentRow.projectCategory,
          }
          this.getProjectConfirmatorFileList(row)
          this.confirmVisible = true
        }
      },
      /*选择上传文件时*/
      onChange(file,fileList){
        const newFileName = file.name;
        if (this.fileName) {
          this.fileName += ', ' + newFileName;
        } else {
          this.fileName = newFileName;
        }
        this.fileList.push(file);
      },
      triggerUpload() {
        this.$refs.uploadFile.$el.querySelector('input').click()
      },
      saveUploadFile(){
        this.confirmData.confirmedDate = moment(this.confirmData.confirmedDate).utcOffset('+8').format('YYYY-MM-DD HH:mm:ss');
        this.confirmData.confirmedBy = this.$store.state.user.userDisplay;
        updateProjectDocumentConfirm(this.confirmData) .then(({data}) => {
          if (data.code === 0) {
            this.confirmVisible = false;
            this.getConfirmProgressDocumentList();
            this.getConfirmProgressPusherList().then(() => {
              // 判断 confirmProgressPusherList 中的 confirmFlag 是否全部为 Y
              let flag = true;
              for (let i = 0; i < this.confirmProgressPusherList.length; i++) {
                if (this.confirmProgressPusherList[i].confirmFlag !== 'Y') {
                  flag = false;
                  break;
                }
              }

              if (flag) {
                this.proofingCurrentRow.status = '正式量产';
                eamProjectPartInfoEdit(this.proofingCurrentRow).then(({ data }) => {
                  this.dataList.forEach((item) => {
                    if (item.projectPartId === this.proofingCurrentRow.projectPartId) {
                      this.dataListIndex = this.dataList.indexOf(item)
                    }
                  })
                  this.getDataList();
                  if (data.code !== 0) {
                    this.$alert(data.msg, '错误', {
                      confirmButtonText: '确定'
                    });
                  }
                });
              }
            }).catch(error => {
              this.$alert('获取确认进度推送列表失败', '错误', {
                confirmButtonText: '确定'
              });
            });
            EventBus.$emit('updateAgencyMatterForConfirm')
          }else {
            this.$alert(data.msg, '错误', {
                    confirmButtonText: '确定'
                  })
          }
        })
        let remark = this.confirmData.remark;
        const formData = new FormData();
        //片接文件
        for (let i = 0; i < this.fileList.length; i++) {
          formData.append("file",this.fileList[i].raw)
        }
        formData.append("folder", 'projectPDConfirmFiles');
        formData.append("orderRef1", this.confirmData.site);
        formData.append("orderRef4", this.confirmData.orderRef1);
        formData.append("orderRef2", this.confirmData.itemNo);
        formData.append("orderRef3", this.confirmData.userid);
        formData.append("orderRef5", this.confirmData.orderRef2);
        formData.append("createdBy", this.$store.state.user.name);
        formData.append("updatedBy", this.$store.state.user.name);
        formData.append("remark", remark);
        uploadProjectFile(formData).then(({data}) => {
          if (data.code === 0) {
            this.$message.success('操作成功');
            //清空文件上传记录
            this.$refs.uploadFile.clearFiles();
            this.closeFileUpdate();
            this.projectConfirmatorFileList = [];
          }else {
            this.$alert(data.msg, '错误', {
                    confirmButtonText: '确定'
                  })
          }
        })
      },
      closeFileUpdate() {
        this.fileName = '';
        this.uploadDialog = false;
        //this.fileRemark = ''
        this.$refs.uploadFile.clearFiles()
        this.fileList = []
      },
      getProjectConfirmatorFileList (row) {
        let inData = {
          orderRef1: row.site,
          orderRef3: row.userid,
          orderRef2: row.itemNo,
          orderRef4: row.orderRef1,
          orderRef5: row.orderRef2,
          page: 1,
          limit: 1000
        }
        searchProjectConfirmatorFileList(inData).then(({data}) => {
          if (data && data.code === 0){
            this.projectConfirmatorFileList = data.page.list;
          }
        })
      },
      closeUploadFileVisible(){
        this.confirmVisible = false;
        this.projectConfirmatorFileList = [];
        this.fileList = [];
        this.closeFileUpdate()
      },
      closeViewDocumentFileVisible(){
        this.viewDocumentFileVisible = false;
        this.projectConfirmatorFileList = [];
      },
      closeViewMassDocumentFileVisible(){
        this.viewMassDocumentFileVisible = false;
        this.projectConfirmatorFileList = [];
      },
      viewDocumentFile(row) {
        this.confirmData = {
          site: row.site,
          documentType: row.documentType,
          orderRef1: row.orderRef1,
          orderRef2: row.orderRef2,
          itemNo: row.itemNo,
          userid: row.userid,
          username: row.username,
          userDisplay: row.userDisplay,
          wantedConfirmDate: row.wantedConfirmDate,
          confirmFlag: row.confirmFlag,
          confirmedDate: new Date(),
          createBy: row.createBy,
          createDate: row.createDate,
          confirmedBy: this.$store.state.user.userDisplay,
          documentId: row.documentId,
          remark: row.remark
        }
        let inData = {
          orderRef1: row.site,
          orderRef2: row.itemNo,
          orderRef3: row.userid,
          orderRef4: row.orderRef1,
          orderRef5: row.orderRef2,
          id : row.documentId,
          page: 1,
          limit: 1000
        }
        searchProjectConfirmatorFileList(inData).then(({data}) => {
          if (data && data.code === 0){
            this.projectConfirmatorFileList = data.page.list;
          }
        })
        this.viewDocumentFileVisible = true
      },
      viewMassDocumentFile(row) {
        let inData = {
          orderRef1: row.site,
          orderRef2: row.proofingId,
          orderRef3: row.documentDefinitionListId,
          orderRef4: row.projectId,
          orderRef5: this.proofingCurrentRow.projectPartId,
          createdBy: row.createdBy,
          id : row.documentId,
          documentType: row.documentType,
          fileName: row.fileName,
          page: 1,
          limit: 1000
        }
        searchProjectConfirmatorFileList(inData).then(({data}) => {
          if (data && data.code === 0){
            this.projectConfirmatorFileList = data.page.list;
          }
        })
        this.viewMassDocumentFileVisible = true
      },
      deleteFile(row) {
        if (this.confirmData.confirmedBy === this.$store.state.user.userDisplay) {
          this.$confirm('是否删除该文件?', '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            let inData = {
              id: row.id,
              orderRef1: row.orderRef1,
              orderRef2: row.orderRef2,
              orderRef3: row.orderRef3,
              orderRef4: row.orderRef4,
              orderRef5: row.orderRef5,
              createdBy: this.$store.state.user.name
            }
            deleteProjectFile(inData).then(({data}) => {
              if (data && data.code === 0) {
                this.$message({
                  message: '删除成功',
                  type: 'success'
                })
                this.getProjectConfirmatorFileList(this.confirmData)
              } else {
                this.$message({
                  message: '删除失败',
                  type: 'error'
                })
              }
            })
          }).catch(() => {
            this.$message({
              type: 'info',
              message: '已取消删除'
            });
          });
        } else {
          this.$message({
            message: '只有确认人员才能删除文件',
            type: 'error'
          })
        }
      },
      shouldShowDelete(row) {
        // 根据条件判断是否显示删除操作
        if (row.projectPhase === 'SOP文档') {
          return false
        }else return row.documentId !== null;
      },
      // 查看文件
      viewFile(row) {
        // 预览文件
        let image = ['jpg', 'jpeg', 'png', 'gif', 'bmp']
        let video = ['mp4', 'avi', 'mov', 'wmv', 'flv']
        let office = ['doc', 'docx', 'ppt', 'pptx', 'xls', 'xlsx']
        let txt = ['txt']
        let type = ''
        let pdf = ['pdf']
        if (image.includes(row.fileType.toLowerCase())) {
          type = 'image/' + row.fileType
          downLoadObjectFile2(row).then(({data}) => {
            const blob = new Blob([data], { type: type });
            // 创建URL来生成预览
            const fileURL = URL.createObjectURL(blob);
            // 在新标签页中打开文件预览
            const newTab = window.open(fileURL, '_blank')
          })
        }
        else if (video.includes(row.fileType.toLowerCase())) {
          type = 'video/' + row.fileType
          downLoadObjectFile2(row).then(({data}) => {
            const blob = new Blob([data], { type: type });
            // 创建URL来生成预览
            const fileURL = URL.createObjectURL(blob);
            // 在新标签页中打开文件预览
            const newTab = window.open(fileURL, '_blank')
          })
        }
        else if (txt.includes(row.fileType.toLowerCase())) {
          type = 'text/plain'
          downLoadObjectFile2(row).then(({data}) => {
            const blob = new Blob([data], { type: type });
            // 创建URL来生成预览
            const fileURL = URL.createObjectURL(blob);
            // 在新标签页中打开文件预览
            const newTab = window.open(fileURL, '_blank')
          })
        }
        else if (office.includes(row.fileType.toLowerCase())) {
          if (row.fileType.toLowerCase() === 'doc' || row.fileType.toLowerCase() === 'docx') {
            type = 'application/vnd.openxmlformats-officedocument.wordprocessingml.document'
          } else if (row.fileType.toLowerCase() === 'ppt' || row.fileType.toLowerCase() === 'pptx') {
            type = 'application/vnd.openxmlformats-officedocument.presentationml.presentation'
          } else {
            type = 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'
          }
          downLoadObjectFile2(row).then(({data}) => {
            // 不限制文件下载类型
            const blob = new Blob([data], {type:'application/octet-stream;charset=utf-8'})
            // 下载文件名称
            const fileName = row.fileName
            // a标签下载
            const linkNode = document.createElement('a')
            linkNode.download = fileName // a标签的download属性规定下载文件的名称
            linkNode.style.display = 'none'
            linkNode.href = URL.createObjectURL(blob) // 生成一个Blob URL
            document.body.appendChild(linkNode)
            linkNode.click() // 模拟在按钮上的一次鼠标单击
            URL.revokeObjectURL(linkNode.href) // 释放URL 对象
            document.body.removeChild(linkNode)
          })
        }
        else if (pdf.includes(row.fileType.toLowerCase())) {
          type = 'application/pdf'
          downLoadObjectFile2(row).then(({data}) => {
            const blob = new Blob([data], { type: type });
            // 创建URL来生成预览
            const fileURL = URL.createObjectURL(blob);
            // 在新标签页中打开文件预览
            const newTab = window.open(fileURL, '_blank')
          })
        }
        else {
          this.$message({
            message: '不支持的文件类型',
            type: 'warning'
          })
        }
      },
      // 下载
      downloadFile (row) {
        downLoadObjectFile2(row)
          .then(({data}) => {
            // 不限制文件下载类型
            const blob = new Blob([data], {type:'application/octet-stream;charset=utf-8'})
            // 下载文件名称
            const fileName = row.fileName
            // a标签下载
            const linkNode = document.createElement('a')
            linkNode.download = fileName // a标签的download属性规定下载文件的名称
            linkNode.style.display = 'none'
            linkNode.href = URL.createObjectURL(blob) // 生成一个Blob URL
            document.body.appendChild(linkNode)
            linkNode.click() // 模拟在按钮上的一次鼠标单击
            URL.revokeObjectURL(linkNode.href) // 释放URL 对象
            document.body.removeChild(linkNode)
          })
      },
      closeProjectProductionValidationDocumentVisibleDialog() {
        this.confirmatoryData = {};
        this.projectAllDocumentConfirmatorList = [];
        this.projectANotDocumentConfirmatorList = [];
        this.projectProductionValidationDocumentVisible = false;
        this.activeName1 = 'selectDocument';
      },
      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 '';
        }
      },
      indexMethod(index) {
        return index + 1;
      },
      // 获取 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.detailColumnList = data.rows
              //   break;
              // case 3:
              //   this.columnList2 = data.rows
              //   break;
              // case 4:
              //   this.columnList3 = data.rows
              //   break;
            }
          } else {
            // this.showDefault = true.
          }
        })
      },
      async fetchBomList() {
        let inData = {
          site: this.proofingCurrentRow.site,
          buNo: this.proofingCurrentRow.buNo,
          projectId: this.proofingCurrentRow.projectId,
          projectNo: this.proofingCurrentRow.projectNo,
          projectDesc: this.proofingCurrentRow.projectDesc,
          projectPartId: this.proofingCurrentRow.projectPartId,
          testPartNo: this.proofingCurrentRow.testPartNo,
          partDesc: this.proofingCurrentRow.partDesc,
          page: 1,
          limit: 1000
        }
        return searchMassProductionBomList(inData).then(({data}) => {
          if (data && data.code === 0){
           return data.list
          }
        })
      },

      // 列表表格选择替换
      tabClick (tab, event) {
        // 刷新列表数据
        this.refreshCurrentTabTable()
      },
      async refreshCurrentTabTable () {
        if (this.activeName == 'proofRecord') {
          this.getRowProjectInfo();
        }
        if (this.activeName == 'massProductionStage') {
          this.getProjectOtherDocument();
        }
        if (this.activeName == 'allDocument'){
          this.searchProjectAllDocumentList()
          this.searchConfirmatorList()
        }
        if (this.activeName == 'productionDocumentsConfirmProgress'){
          this.getConfirmProgressDocumentList()
          this.getConfirmProgressPusherList()
        }
        if (this.activeName == 'massProductionBOM' && this.proofingCurrentRow.finalPartNo !== '' && this.proofingCurrentRow.finalPartNo !== null){
          this.dataListLoading = true;
          try {
            // 模拟从后端获取数据
            const flatData = await this.fetchBomList();
            // 将平铺数据转换为树形结构
            this.projectPartBomList = arrayToTreeByLevelCode(flatData, "levelCode", "children");
            // 打印结果
            console.log(JSON.stringify(this.projectPartBomList, null, 2));
          } finally {
            this.dataListLoading = false;
          }
        } else {
          this.projectPartBomList = []
        }
      },
      //获取按钮的权限数据
      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
      },
      warnSendMail(row) {
        row.projectPartId = this.proofingCurrentRow.projectPartId
        row.testPartNo = this.proofingCurrentRow.testPartNo
        row.partDesc = this.proofingCurrentRow.partDesc
        row.needDate = this.proofingCurrentRow.needDate
        this.$confirm('确认发送提醒?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          warnSendMailHandle(row).then(({data}) => {
            if (data && data.code === 0) {
              this.$message({
                message: '发送成功',
                type: 'success'
              })
            } else {
              this.$alert(data.msg, '错误', {
                    confirmButtonText: '确定'
                  })
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消发送'
          });
        });
      },
      confirmatorSendMailHandle(inData) {
        confirmatorSendMailHandle(inData).then(({data}) => {
          if (data && data.code === 0) {
            this.$message({
              message: '发送成功',
              type: 'success'
            })
          } else {
            this.$alert(data.msg, '错误', {
                    confirmButtonText: '确定'
                  })
          }
        })
      },
    }
  }
</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>
