<template>
  <div class="mod-config" v-highlight-container>
    <el-form :inline="true" label-position="top" style="margin-top: 1px; margin-left: 0px;" >
        <el-row :gutter="20">
          <el-col :span="18">
            <el-form-item  label="Process">
              <dict-data-select :site="searchData.site" v-if="searchData.site"  v-model="sheetData.process" :use-default-value="false" dict-type="bm_process" style="width: 120px"></dict-data-select>
            </el-form-item>
            <el-form-item >
                <span slot="label" style="" @click="getBaseList(1)"><a herf="#">热转移打印人员</a></span>
                <el-input v-model="sheetData.overPrintOperatorName" ref="overPrintOperatorName" placeholder="请选择人员" readonly style="width: 120px" ></el-input>
            </el-form-item>
            <el-form-item  >
              <span slot="label" style="" @click="getBaseList(2)"><a herf="#">印刷人员</a></span>
              <el-input v-model="sheetData.printOperatorName" ref="printOperatorName"  placeholder="请选择人员" readonly style="width: 120px" ></el-input>
            </el-form-item>
            <el-form-item  label=" ">
              <el-button type="primary" @click="updateBMProcess()" v-if="(!ifDisableFlag&&isAuth('103002:bmSave'))||(superAdmin)">保存数据</el-button>
              <el-button v-if="baseForm.status === 'spz'&&((!ifDisableFlag&&spForm.sp.includes(searchData.username))||(superAdmin))" type="primary" @click="agreeSubmit">同意</el-button>
              <el-button v-if="baseForm.status === 'spz' && ((baseForm.isReject === 'Y' &&!ifDisableFlag&&spForm.sp.includes(searchData.username))||(superAdmin))" type="primary" @click="submitDataModal">驳回</el-button>
            </el-form-item>
          </el-col>
          <el-col :span="3"><div class="grid-content bg-purple">
            <el-form-item :label="'当前节点'" style="width: 100%">
              <el-input v-model="spForm.nodeName" disabled  ></el-input>
            </el-form-item>
          </div>
          </el-col>
          <el-col :span="3"><div class="grid-content bg-purple">
            <el-form-item :label="'当前节点审批人'" style="width: 100%">
              <el-input v-model="spForm.sp" disabled  ></el-input>
            </el-form-item>
          </div>
          </el-col>
        </el-row>

    </el-form>
    <el-form label-position="top" style="margin-top: 1px; margin-left: 0px;" v-if="searchData.buNo=='RDC'">
      <el-row :gutter="20" >
        <el-col :span="24"><div class="grid-content bg-purple">
          <el-form-item :label="'过程及过程控制/Process and Production Control'">
            <el-input
              type="textarea"
              v-model="dataForm.processDetail "
              :rows="3"
              resize='none'
              maxlength="255"
              show-word-limit
              :disabled="ifDisableFlag"
              style="height: 60px" >
            </el-input>
          </el-form-item>
        </div></el-col>
      </el-row>
      <el-row :gutter="20" style="margin-top: 60px">
        <el-col :span="6"><div class="grid-content bg-purple">
          <el-form-item :label="'是否提供胶条/Supply Adhesive Tape'">
            <el-select clearable v-model="dataForm.supplyAdhesiveTape" :disabled="ifDisableFlag">
              <el-option label="Yes" value="Y"></el-option>
              <el-option label="No" value="N"></el-option>
            </el-select>
          </el-form-item>
        </div></el-col>
        <el-col :span="18"><div class="grid-content bg-purple">
          <el-form-item :label="'图稿/Drawing'">
            <el-input v-model="dataForm.routingDrawing" :disabled="ifDisableFlag"  ></el-input>
          </el-form-item>
        </div></el-col>
      </el-row>
      <el-row :gutter="20" >
        <el-col :span="6"><div class="grid-content bg-purple">
          <el-form-item :label="'图稿版本/Drawing Revison'">
            <el-input v-model="dataForm.drawingRevison" :disabled="ifDisableFlag"  ></el-input>
          </el-form-item>
        </div></el-col>
        <el-col :span="6"><div class="grid-content bg-purple">
          <el-form-item :label="'图稿日期/Drawing Date'">
            <el-date-picker
              v-model="searchData.drawingDate"
              type="date"
              value-format="yyyy-MM-dd"
              :disabled="ifDisableFlag"
              placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </div></el-col>
      </el-row>
      <el-row :gutter="20" >
        <el-col :span="24"><div class="grid-content bg-purple">
          <el-form-item :label="'作业说明/WI'">
            <el-input
              type="textarea"
              v-model="dataForm.workInfo"
              :rows="3"
              resize='none'
              maxlength="255"
              show-word-limit
              :disabled="ifDisableFlag"
              style="height: 60px" >
            </el-input>
          </el-form-item>
        </div></el-col>
      </el-row>
      <el-row :gutter="20" style="margin-top: 60px">
        <el-col :span="6"><div class="grid-content bg-purple">
          <el-form-item :label="'作业说明版本/WI Revison'">
            <el-input v-model="dataForm.wiRevison" :disabled="ifDisableFlag"  ></el-input>
          </el-form-item>
        </div></el-col>
        <el-col :span="6"><div class="grid-content bg-purple">
          <el-form-item :label="'作业说明日期/WI Date'">
            <el-date-picker
              v-model="searchData.wiDate"
              type="date"
              value-format="yyyy-MM-dd"
              :disabled="ifDisableFlag"
              placeholder="选择日期">
            </el-date-picker>
          </el-form-item>
        </div></el-col>
      </el-row>
      <el-row :gutter="20"   >
        <el-col :span="6"><div class="grid-content bg-purple">
          <el-form-item>
            <span slot="label" style="" @click="reviewEngineerChooseModal()"><a herf="#">选择审查工程师/Select ME Review Engineer</a></span>
            <el-input v-model="dataForm.reviewEngineer" readonly style=""  @focus="reviewEngineerChooseModal()" ></el-input>
          </el-form-item>
        </div></el-col>
        <el-col :span="6"><div class="grid-content bg-purple">
          <el-form-item >
            <span slot="label" style="" @click="peEngineerChooseModal()"><a herf="#">选择PE工程师/Select PE Engineer</a></span>
            <el-input v-model="dataForm.peEngineer" readonly style=""  @focus="peEngineerChooseModal()" ></el-input>
          </el-form-item>
        </div></el-col>
        <el-col :span="6"><div class="grid-content bg-purple">
          <el-form-item >
            <span slot="label" style="" @click="cqeModal()"><a herf="#">选择CQE/Select CQE</a></span>
            <el-input v-model="dataForm.cqe" readonly style=""  @focus="cqeModal()" ></el-input>
          </el-form-item>
        </div></el-col>
      </el-row>
      <el-row :gutter="20" >
        <el-col :span="24"><div class="grid-content bg-purple">
          <el-form-item :label="'备注/Remark'">
            <el-input
              type="textarea"
              v-model="dataForm.routingRemark"
              :rows="3"
              resize='none'
              maxlength="255"
              show-word-limit
              :disabled="ifDisableFlag"
              style="height: 60px" >
            </el-input>
          </el-form-item>
        </div></el-col>
      </el-row>
      <el-row :gutter="20" style="margin-top: 60px">
        <el-col :span="24"><div class="grid-content bg-purple">
          <el-form-item :label="'Action'">
            <el-input
              type="textarea"
              v-model="dataForm.routingAction"
              :rows="3"
              resize='none'
              maxlength="255"
              show-word-limit
              :disabled="ifDisableFlag"
              style="height: 60px" >
            </el-input>
          </el-form-item>
        </div></el-col>
      </el-row>
      <el-form-item style="margin-top: 60px;text-align:center">
        <el-button type="primary" @click="saveData()" v-if="!ifDisableFlag">保存</el-button>
      </el-form-item>
    </el-form>

    <el-form label-position="top" style="margin-top: 1px; margin-left: 0px;" v-if="searchData.buNo!='RDC'">
      <el-form :inline="true" label-position="top" style="margin-top: 1px; margin-left: 0px;" >
        <el-form-item  label="物料">
          <el-input v-model="routeData.partNo" readonly style="width: 120px"></el-input>
        </el-form-item>
        <el-form-item  label="工艺路线类型">
          <el-input v-model="routeData.routingType" readonly style="width: 120px"></el-input>
        </el-form-item>
        <el-form-item  label="工艺路线版本">
          <el-input v-model="routeData.routingRevision" readonly style="width: 120px"></el-input>
        </el-form-item>
        <el-form-item  label="替代编码">
          <el-input v-model="routeData.alternativeNo" readonly style="width: 120px"></el-input>
        </el-form-item>
        <el-form-item  label=" ">
          <el-button type="primary" @click="searchTable(true)" >刷新</el-button>
          <el-button type="primary" @click="changeRouteRev()" v-if="!ifDisableFlag">变更</el-button>
          <el-button type="primary" @click="jumpRoute()" >跳转至Routing</el-button>

        </el-form-item>
      </el-form>
      <el-table
        :height="'250'"
        :data="tableData"
        highlight-current-row
        border
        @row-click="chooseRoute"
        style="width: 100%">
        <el-table-column
          fixed="left"
          header-align="center"
          align="center"
          width="60"
          label="操作">
          <template slot-scope="scope">
            <a type="text" size="small" @click="bmModel(scope.row)" v-if="!ifDisableFlag&&isAuth('103002:bmRoute')">填写</a>
          </template>
        </el-table-column>
        <el-table-column
          v-for="(item,index) in columnList1" :key="index"
          :sortable="item.columnSortable"
          :prop="item.columnProp"
          :header-align="item.headerAlign"
          :show-overflow-tooltip="item.showOverflowTooltip"
          :align="item.align"
          :fixed="item.fixed == ''?false:item.fixed"
          :min-width="item.columnWidth"
          :label="item.columnLabel">
          <template slot-scope="scope">
            <span v-if="!item.columnHidden">{{scope.row[item.columnProp]}}</span>
            <span v-if="item.columnImage"><img :src="scope.row[item.columnProp]" style="width: 100px; height: 80px"/></span>
          </template>
        </el-table-column>
      </el-table>
      <component style="margin-top: 5px" :is="selectedComponent" ref="routeRef"  :key="componentKey" ></component>
    </el-form>

<!--    <el-dialog append-to-body title="工艺路线" :close-on-click-modal="false" v-drag :visible.sync="routeFlag" width="470px">-->
<!--      <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">-->
<!--            <el-form-item :label="'工序编码'">-->
<!--              <el-input v-model="routingData.itemNo" type="number" onkeyup="value=value.replace(/^(0+)|[^\d]+/g,'')" ></el-input>-->
<!--            </el-form-item>-->
<!--            <el-form-item :label="'工序名称'">-->
<!--              <el-input v-model="routingData.operationDesc" style="width: 440px" ></el-input>-->
<!--            </el-form-item>-->
<!--      </el-form>-->
<!--      <el-footer style="height:40px;margin-top: 10px;text-align:center">-->
<!--        <el-button type="primary" @click="routeSave()">保存</el-button>-->
<!--        <el-button type="primary" @click="routeFlag = false">取消</el-button>-->
<!--      </el-footer>-->
<!--    </el-dialog>-->



    <el-dialog
      width="530px"
      title="审查工程师"
      :close-on-click-modal="false"
      :visible.sync="reviewEngineerFlag">
      <el-transfer v-model="reviewEngineerList" class="rq" filterable  :props="{
      key: 'operatorId',
      label: 'operatorName'
    }" :data="operatorList" :titles="['未选择', '已选择']"></el-transfer>
      <span slot="footer" class="dialog-footer">
        <div style="margin-top: 5px">
                <el-button type="primary" @click="savereviewEngineerList()">确定</el-button>
                <el-button @click="reviewEngineerFlag = false" type="primary">取消</el-button>
        </div>
    </span>
    </el-dialog>
    <el-dialog
      width="530px"
      title="PE工程师"
      :close-on-click-modal="false"
      :visible.sync="peEngineerFlag">
      <el-transfer v-model="peEngineerList" class="rq" filterable :props="{
      key: 'operatorId',
      label: 'operatorName'
    }" :data="operatorList" :titles="['未选择', '已选择']"></el-transfer>
      <span slot="footer" class="dialog-footer">
        <div style="margin-top: 5px">
                <el-button type="primary" @click="savepeEngineerList()">确定</el-button>
                <el-button @click="peEngineerFlag = false" type="primary">取消</el-button>
        </div>
    </span>
    </el-dialog>
    <el-dialog
      width="530px"
      title="选择CQE"
      :close-on-click-modal="false"
      :visible.sync="cqeFlag">
      <el-transfer v-model="cqeList" class="rq" filterable :props="{
      key: 'operatorId',
      label: 'operatorName'
    }" :data="operatorList" :titles="['未选择', '已选择']"></el-transfer>
      <span slot="footer" class="dialog-footer">
        <div style="margin-top: 5px">
                <el-button type="primary" @click="savecqeList()">确定</el-button>
                <el-button @click="cqeFlag = false" type="primary">取消</el-button>
        </div>
    </span>
    </el-dialog>

    <el-dialog
      append-to-body
      width="900px"
      title="工序记录"
      top="10vh"
      @close="closeItemModel"
      :close-on-click-modal="false"
      :visible.sync="routeModelFlag">
      <el-form label-position="top" style="margin-top: -5px; margin-left: 0px;" >
        <el-row :gutter="20">
          <el-col :span="6"><div class="grid-content bg-purple">
            <el-form-item :label="'工序编码'">
              <el-input v-model="currentRow.operationNo" disabled ></el-input>
            </el-form-item>
          </div></el-col>
          <el-col :span="6"><div class="grid-content bg-purple">
            <el-form-item :label="'工序名称'">
              <el-input v-model="currentRow.operationName" disabled ></el-input>
            </el-form-item>
          </div></el-col>
        </el-row>
      </el-form>
      <div v-if="currentRow.itemType === 'prepress'">
          <prepress  ref="prepress"  @closeModel="closeModel"></prepress>
      </div>
      <div v-else-if="currentRow.itemType === 'printing'">
        <printing ref="printing"  @closeModel="closeModel"></printing>
      </div>
      <div v-else-if="currentRow.itemType === 'printOther'">
        <printOther ref="printOther" @closeModel="closeModel"></printOther>
      </div>
      <div v-else-if="currentRow.itemType === 'overprinting'">
        <overprinting ref="overprinting" @closeModel="closeModel"></overprinting>
      </div>
      <div v-else-if="currentRow.itemType === 'slitting'">
        <slitting ref="slitting" @closeModel="closeModel"></slitting>
      </div>
      <div v-else-if="currentRow.itemType === 'lamTemperature'">
        <lamTemperature ref="lamTemperature" @closeModel="closeModel"></lamTemperature>
      </div>
      <div v-else-if="currentRow.itemType === 'cutting'">
        <cutting ref="cutting" @closeModel="closeModel"></cutting>
      </div>
      <div v-else-if="currentRow.itemType === 'InkMixing'">
        <InkMixing ref="InkMixing" @closeModel="closeModel"></InkMixing>
      </div>
      <div v-else-if="currentRow.itemType === 'InkFormulation'">
        <InkFormulation ref="InkFormulation" @closeModel="closeModel"></InkFormulation>
      </div>
      <div v-else-if="currentRow.itemType === 'lamination'">
        <lamination ref="lamination" @closeModel="closeModel"></lamination>
      </div>
      <div v-else-if="currentRow.itemType === 'CNC'">
        <CNC ref="CNC" @closeModel="closeModel"></CNC>
      </div>
      <div v-else-if="currentRow.itemType === 'Cut'">
        <Cut ref="Cut" @closeModel="closeModel"></Cut>
      </div>
      <div v-else-if="currentRow.itemType === 'packagePage'">
        <packagePage ref="packagePage" @closeModel="closeModel"></packagePage>
      </div>
      <div v-else-if="currentRow.itemType === 'fqc'">
        <fqc ref="fqc" @closeModel="closeModel"></fqc>
      </div>
      <div v-else-if="currentRow.itemType === 'cqc'">
        <cqc ref="cqc" @closeModel="closeModel"></cqc>
      </div>
      <div v-else-if="currentRow.itemType === 'printFlexo'">
        <printFlexo ref="printFlexo" @closeModel="closeModel"></printFlexo>
      </div>
      <div v-else-if="currentRow.itemType === 'printIndigo'">
        <printIndigo ref="printIndigo" @closeModel="closeModel"></printIndigo>
      </div>
    </el-dialog>
    <el-dialog title="变更工艺路线" :close-on-click-modal="false" v-drag :visible.sync="modalFlag" width="750px">
      <el-table
        :data="routeDetailList"
        height="300"
        border
        highlight-current-row
        onclick=""
        @row-click="getRow"
        ref="componentTable"
        style="width:100%">
        <el-table-column
          prop="partNo"
          header-align="left"
          align="left"
          min-width="80"
          label="物料编码">
        </el-table-column>
        <el-table-column
          prop="routingType"
          header-align="left"
          align="left"
          min-width="80"
          label="Routing类型">
        </el-table-column>
        <el-table-column
          prop="routingRevision"
          header-align="left"
          align="left"
          min-width="80"
          label="Routing版本">
        </el-table-column>
        <el-table-column
          prop="alternativeNo"
          header-align="left"
          align="left"
          min-width="80"
          label="替代编码">
        </el-table-column>
        <el-table-column
          prop="alternativeDescription"
          header-align="left"
          align="left"
          min-width="80"
          label="替代名称">
        </el-table-column>
        <el-table-column
          prop="status"
          header-align="left"
          align="left"
          min-width="60"
          label="状态">
        </el-table-column>
        <el-table-column
          prop="effPhaseInDate"
          header-align="left"
          align="left"
          min-width="80"
          label="生效日期">
        </el-table-column>
        <el-table-column
          prop="effPhaseOutDate"
          header-align="left"
          align="left"
          min-width="80"
          label="失效日期">
        </el-table-column>
      </el-table>

      <el-footer style="height:30px;margin-top:20px;text-align:center">
        <el-button type="primary" @click="updateBMRouteRev()">确定</el-button>
        <el-button type="primary" @click="modalFlag=false">取消</el-button>
      </el-footer>
    </el-dialog>
    <ChooseUser ref="baseList"  @getBaseData="getBaseData"></ChooseUser>
    <!-- 提交 -->
    <el-dialog title="驳回" top="30vh" :close-on-click-modal="false" v-drag :visible.sync="submitModalFlag" width="500px">
      <el-form :inline="true" label-position="top">
        <el-form-item :label="'驳回意见'">
          <el-input type="textarea" v-model="rejectOpinion" :rows="3" resize='none' show-word-limit style="width: 479px;height: 30px"></el-input>
        </el-form-item>
      </el-form>
      <el-footer style="height:30px;margin-top: 50px;text-align:center">
        <el-button type="primary" @click="rejectSubmit">确定</el-button>
        <el-button type="primary" @click="submitModalFlag = false">取消</el-button>
      </el-footer>
    </el-dialog>
  </div>
</template>

<script>
  import {
    searchBMRoutingDetail,
    searchTechnicalSpecificationTeamStr,
    updateBMRoutingDetail,
    searchBMRoute,
    searchRouteDetail,
    updateBMRouteRev,
    tsdBasicInformationSearch,
    updateBMProcess,
    submitChange,getBMStatusDesc, // 提交
    getOADetailForBM,
  } from "@/api/sampleManagement/technicalSpecificationList.js"
  import {
    getNodeAuthority, // 获取节点权限
  } from '@/api/changeManagement/changeManagement.js'
  import ChooseUser from '@/views/modules/common/ChooseUser'
  import {
    searchOperatorWithSite,
  } from "@/api/project/project.js"
  import prepress from "./com_bm_prepress";/*组件*/
  import printing from "./com_bm_printing";/*组件*/
  import printOther from "./com_bm_printOther";/*组件*/
  import overprinting from "./com_bm_demoSlot";/*组件*/
  import slitting from "./com_bm_demoSlot";/*组件*/
  import lamTemperature from "./com_bm_demoSlot";/*组件*/
  import cutting from "./com_bm_demoSlot";/*组件*/
  import InkMixing from "./com_bm_inkMixing";/*组件*/
  import InkFormulation from "./com_bm_inkFormulation";/*组件*/
  import lamination from "./com_bm_lamination";/*组件*/
  import CNC from "./com_bm_cnc";
  import Cut from "./com_bm_cut";
  import packagePage from "./com_bm_demoSlot";/*组件*/
  import fqc from "./com_bm_demoSlot";/*组件*/
  import cqc from "./com_bm_demoSlot";/*组件*/
  import printFlexo from "./com_bm_printingFlexo";/*组件*/
  import printIndigo from "./com_bm_printingIndigo";
  import DictDataSelect from "../../sys/dict-data-select-highlight";
  /*组件*/
  export default {
    components: {
      DictDataSelect,
      ChooseUser,
      prepress,
      printing,
      printOther,
      overprinting,
      slitting,
      lamTemperature,
      cutting,
      InkMixing,
      InkFormulation,
      lamination,
      CNC,
      Cut,
      packagePage,
      fqc,
      cqc,
      printFlexo,
      printIndigo,
    },

    data() {
      return {
        spForm:{
          sp:'',
          nodeName:'',
        },
        nowRoute:{},
        //动态组件
        selectedComponent: null,
        routeData:{
          site: '',
          partNo:'',
          alternativeNo:'',
          routingType:'',
          routingRevision:'',
        },
        componentKey:0,
        routeFlag:false,
        routeModelFlag:false,
        height:200,
        searchData: {
          site: '',
          username: this.$store.state.user.name,
          codeNo: '',
          buNo:'',
          fieldId:'',
        },
        baseForm:{
          status:'',
          isReject:'',
        },
        tableData:'',
        partList:[],
        superAdmin:false,
        ifDisableFlag:false,
        sheetData:{
          site: '',
          codeNo: '',
          process:'',
          overPrintOperator:'',
          overPrintOperatorName:'',
          printOperator:'',
          printOperatorName:'',
        },
        dataForm:{
          site: '',
          codeNo:'',
          processDetail:'',
          supplyAdhesiveTape: '',
          routingDrawing:'',
          drawingRevison:'',
          drawingDate:'',
          workInfo:'',
          wiRevison:'',
          wiDate:'',
          reviewEngineer: '',
          routingRemark:'',
          routingAction:'',
          username:this.$store.state.user.name,
          peEngineer:'',
          cqe:'',
          reviewEngineerList:[],
          peEngineerList:[],
          cqeList:[],
        },
        reviewEngineerFlag:false,
        peEngineerFlag:false,
        cqeFlag:false,
        operatorList:[],
        reviewEngineerList:[],
        peEngineerList:[],
        cqeList:[],
        //工艺路线部分
        routingData:{
          id:0,
          site:'',
          codeNo:'',
          itemNo:'',
          operationDesc:'',
          remark:'',
          username:'',
        },
        columnList1: [
          {
            userId: this.$store.state.user.name,
            functionId: 104003,
            serialNumber: '104003Table2OperationNo',
            tableId: '104003Table2',
            tableName: 'Routing工序表',
            columnProp: 'operationNo',
            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: 104003,
            serialNumber: '104003Table2OperationName',
            tableId: '104003Table2',
            tableName: 'Routing工序表',
            columnProp: 'operationName',
            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: 104003,
            serialNumber: '104003Table2EfficiencyFactor',
            tableId: '104003Table2',
            tableName: 'Routing工序表',
            columnProp: 'efficiencyFactor',
            headerAlign: 'center',
            align: 'right',
            columnLabel: '效率',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 104003,
            serialNumber: '104003Table2MachRunFactor',
            tableId: '104003Table2',
            tableName: 'Routing工序表',
            columnProp: 'machRunFactor',
            headerAlign: 'center',
            align: 'right',
            columnLabel: '机器单位产出',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 104003,
            serialNumber: '104003Table2MachSetupTime',
            tableId: '104003Table2',
            tableName: 'Routing工序表',
            columnProp: 'machSetupTime',
            headerAlign: 'center',
            align: 'right',
            columnLabel: '机器调机时间',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 104003,
            serialNumber: '104003Table2RunTimeCode',
            tableId: '104003Table2',
            tableName: 'Routing工序表',
            columnProp: 'runTimeCode',
            headerAlign: 'center',
            align: 'center',
            columnLabel: '产出单位',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 60
          },
          {
            userId: this.$store.state.user.name,
            functionId: 104003,
            serialNumber: '104003Table2LaborRunFactor',
            tableId: '104003Table2',
            tableName: 'Routing工序表',
            columnProp: 'laborRunFactor',
            headerAlign: 'center',
            align: 'right',
            columnLabel: '人工单位产出',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 104003,
            serialNumber: '104003Table2LaborSetupTime',
            tableId: '104003Table2',
            tableName: 'Routing工序表',
            columnProp: 'laborSetupTime',
            headerAlign: 'center',
            align: 'right',
            columnLabel: '人工调机时间',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 104003,
            serialNumber: '104003Table2CrewSize',
            tableId: '104003Table2',
            tableName: 'Routing工序表',
            columnProp: 'crewSize',
            headerAlign: 'center',
            align: 'right',
            columnLabel: '生产过程中人数',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 104003,
            serialNumber: '104003Table2SetupCrewSize',
            tableId: '104003Table2',
            tableName: 'Routing工序表',
            columnProp: 'setupCrewSize',
            headerAlign: 'center',
            align: 'right',
            columnLabel: '调机过程中人数',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 80
          },
          {
            userId: this.$store.state.user.name,
            functionId: 104003,
            serialNumber: '104003Table2OutsideOpItem',
            tableId: '104003Table2',
            tableName: 'Routing工序表',
            columnProp: 'outsideOpItem',
            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: 104003,
            serialNumber: '104003Table2MachineNo',
            tableId: '104003Table2',
            tableName: 'Routing工序表',
            columnProp: 'machineNo',
            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: 104003,
            serialNumber: '104003Table2WorkCenterNo',
            tableId: '104003Table2',
            tableName: 'Routing工序表',
            columnProp: 'workCenterNo',
            headerAlign: 'center',
            align: 'center',
            columnLabel: '加工中心编码',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 85
          },
          {
            userId: this.$store.state.user.name,
            functionId: 104003,
            serialNumber: '104003Table2WorkCenterDesc',
            tableId: '104003Table2',
            tableName: 'Routing工序表',
            columnProp: 'workCenterDesc',
            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: 104003,
            serialNumber: '104003Table2LaborClassNo',
            tableId: '104003Table2',
            tableName: 'Routing工序表',
            columnProp: 'laborClassDesc',
            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: 104003,
            serialNumber: '104003Table2SetupLaborClassDesc',
            tableId: '104003Table2',
            tableName: 'Routing工序表',
            columnProp: 'setupLaborClassDesc',
            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: 104003,
            serialNumber: '104003Table2NoteText',
            tableId: '104003Table2',
            tableName: 'Routing工序表',
            columnProp: 'noteText',
            headerAlign: 'center',
            align: 'left',
            columnLabel: '备注',
            columnHidden: false,
            columnImage: false,
            columnSortable: false,
            sortLv: 0,
            status: true,
            fixed: '',
            columnWidth: 150
          },
        ],
        currentRow:{},
        //变更工艺路线
        modalFlag:false,
        routeDetailList:[],
        currentRoute:null,
        tagNo:'',
        tagNo1:'',
        rejectOpinion: '',
        submitModalFlag: false,
      }
    },
    mounted () {
      this.$nextTick(() => {
        this.height = window.innerHeight - 100
      })
    },
    methods: {
      // 获取基础数据列表S
      getBaseList ( type) {
        if(this.ifDisableFlag){
          return false
        }
        this.tagNo1 = type
        this.$nextTick(() => {
          let strVal = ''

            if(type==1) {
              strVal = this.sheetData.overPrintOperator
            }
            if(type==2) {
              strVal = this.sheetData.printOperator
            }

          this.$refs.baseList.init(this.searchData.site,this.searchData.buNo, strVal)
        })
      },
      /* 列表方法的回调 */
      getBaseData (val) {

        if(this.tagNo1==1) {
          this.sheetData.overPrintOperator = val.username
          this.sheetData.overPrintOperatorName = val.userDisplay
          this.$nextTick(() => {
            this.$triggerInputEvent(this.$refs.overPrintOperatorName);
          });
        }
        if(this.tagNo1==2) {
          this.sheetData.printOperator = val.username
          this.sheetData.printOperatorName = val.userDisplay
          this.$nextTick(() => {
            this.$triggerInputEvent(this.$refs.printOperatorName);
          });
        }

      },



      //初始化组件的参数
      init(inData) {
        if(this.dataForm.codeNo!=null&&this.dataForm.codeNo!=''){
          return false;
        }
        //初始化参数
        this.searchData = JSON.parse(JSON.stringify(inData));
        //刷新表格
        this.searchTable();

      },
      searchTable(type){
        tsdBasicInformationSearch(this.searchData).then(({data}) => {
          if(data&& data.code===0){
            this.sheetData=data.row
            this.baseForm=data.row;
            this.routeData.site=data.row.site
            this.routeData.partNo=data.row.finalPartNo
            this.getNodeAuthority(data.row)
            if(type){
              this.$message.success( '操作成功')
            }
          }else {
            this.$message.error(data.msg)
          }

        });
        getOADetailForBM(this.searchData).then(({data}) => {
          this.spForm.nodeName = data.row.nodeName
          this.spForm.sp = data.row.sp
        })
        if(this.searchData.buNo==='RDC'){
          searchBMRoutingDetail(this.searchData).then(({data}) => {
            if(data&& data.code===0){
              if(data.rows.length>0){
                this.dataForm=data.rows[0]
              }else {
                this.dataForm.site=this.searchData.site
                this.dataForm.codeNo=this.searchData.codeNo
              }
            }else {
              this.$message.error(data.msg)
            }
          });
          let inData = {
            site: this.searchData.site,
            codeNo: this.searchData.codeNo,
            type: 'reviewEngineer',
          }
          searchTechnicalSpecificationTeamStr(inData).then(({data}) => {
            this.dataForm.reviewEngineerList = data.rows
          })
          let inData2 = {
            site: this.searchData.site,
            codeNo: this.searchData.codeNo,
            type: 'cqe',
          }
          searchTechnicalSpecificationTeamStr(inData2).then(({data}) => {
            this.dataForm.cqeList = data.rows
          })
          let inData3 = {
            site: this.searchData.site,
            codeNo: this.searchData.codeNo,
            type: 'peEngineer',
          }
          searchTechnicalSpecificationTeamStr(inData3).then(({data}) => {
            this.dataForm.peEngineerList = data.rows
          })

        }else {
          searchBMRoute(this.searchData).then(({data}) => {
            if(data&& data.code===0){
              this.tableData = data.rows;
              this.routeData = data.row;
            }else {
              this.$message.error(data.msg)
            }
          });
        }
      },
      closeModel(){
        this.routeModelFlag=false;
      },
      //根据itemType
      bmModel(row){
        this.currentRow=row;
        this.routeModelFlag=true
        setTimeout(() => {
          switch (this.currentRow.itemType) {
            case 'prepress':
              this.getPrepress();
            case 'printing':
              this.getPrinting();
            case 'printOther':
              this.getPrintOther();
            case 'overprinting':
              this.getOverprinting();
            case 'slitting':
              this.getSlitting();
            case 'lamTemperature':
              this.getLamTemperature();
            case 'cutting':
              this.getCutting();
            case 'InkMixing':
              this.getInkMixing();
            case 'InkFormulation':
              this.getInkFormulation();
            case 'lamination':
              this.getLamination();
            case 'CNC':
              this.getCNC();
            case 'Cut':
              this.getCut();
            case 'packagePage':
              this.getPackagePage();
            case 'fqc':
              this.getFqc();
            case 'cqc':
              this.getCqc();
            case 'printFlexo':
              this.getPrintFlexo();
            case 'printIndigo':
              this.getPrintIndigo();
          }
        }, 500);
      },
      getPrepress(){
        let inData=JSON.parse(JSON.stringify(this.searchData))
        inData.type='prepress'
        this.$refs.prepress.init(inData)
      },
      getPrinting(){
        let inData=JSON.parse(JSON.stringify(this.searchData))
        inData.type='printing'
        this.$refs.printing.init(inData)
      },
      getPrintOther(){
        let inData=JSON.parse(JSON.stringify(this.searchData))
        inData.type='printOther'
        this.$refs.printOther.init(inData)
      },
      getOverprinting(){
        let inData=JSON.parse(JSON.stringify(this.searchData))
        inData.type='overprinting'
        this.$refs.overprinting.init(inData)
      },
      getSlitting(){
        let inData=JSON.parse(JSON.stringify(this.searchData))
        inData.type='slitting'
        this.$refs.slitting.init(inData)
      },
      getLamTemperature(){
        let inData=JSON.parse(JSON.stringify(this.searchData))
        inData.type='lamTemperature'
        this.$refs.lamTemperature.init(inData)
      },
      getCutting(){
        let inData=JSON.parse(JSON.stringify(this.searchData))
        inData.type='cutting'
        this.$refs.cutting.init(inData)
      },
      getInkMixing(){
        let inData=JSON.parse(JSON.stringify(this.searchData))
        inData.type='InkMixing'
        this.$refs.InkMixing.init(inData)
      },
      getInkFormulation(){
        let inData=JSON.parse(JSON.stringify(this.searchData))
        inData.type='InkFormulation'
        this.$refs.InkFormulation.init(inData)
      },
      getLamination(){
        let inData=JSON.parse(JSON.stringify(this.searchData))
        inData.type='lamination'
        this.$refs.lamination.init(inData)
      },
      getCNC(){
        let inData=JSON.parse(JSON.stringify(this.searchData))
        inData.type='CNC'
        this.$refs.CNC.init(inData)
      },
      getCut(){
        let inData=JSON.parse(JSON.stringify(this.searchData))
        inData.type='Cut'
        this.$refs.Cut.init(inData)
      },
      getPackagePage(){
        let inData=JSON.parse(JSON.stringify(this.searchData))
        inData.type='packagePage'
        this.$refs.packagePage.init(inData)
      },
      getFqc(){
        let inData=JSON.parse(JSON.stringify(this.searchData))
        inData.type='fqc'
        this.$refs.fqc.init(inData)
      },
      getCqc(){
        let inData=JSON.parse(JSON.stringify(this.searchData))
        inData.type='cqc'
        this.$refs.cqc.init(inData)
      },
      getPrintFlexo(){
        let inData=JSON.parse(JSON.stringify(this.searchData))
        inData.type='printFlexo'
        this.$refs.printFlexo.init(inData)
      },
      getPrintIndigo(){
        let inData=JSON.parse(JSON.stringify(this.searchData))
        inData.type='printIndigo'
        this.$refs.printIndigo.init(inData)
      },
      reviewEngineerChooseModal(){
        if(this.ifDisableFlag){
          return false
        }
        let inData={
          site:this.searchData.site,
        }
        searchOperatorWithSite(inData).then(({data}) => {
          this.operatorList=data.rows
        })
        this.reviewEngineerList = JSON.parse(JSON.stringify(this.dataForm.reviewEngineerList));
        this.reviewEngineerFlag=true
      },

      savereviewEngineerList(){
        let reviewEngineerName='';
        for (let i = 0; i < this.reviewEngineerList.length; i++) {
          let select= this.operatorList.filter(item => item.operatorId === this.reviewEngineerList[i])
          if(select.length>0){
            reviewEngineerName+=select[0].operatorName+';'
          }
        }
        this.dataForm.reviewEngineer=reviewEngineerName
        this.dataForm.reviewEngineerList=JSON.parse(JSON.stringify(this.reviewEngineerList));
        this.reviewEngineerFlag=false
      },

      peEngineerChooseModal(){
        if(this.ifDisableFlag){
          return false
        }
        let inData={
          site:this.searchData.site,
        }
        searchOperatorWithSite(inData).then(({data}) => {
          this.operatorList=data.rows
        })
        this.peEngineerList = JSON.parse(JSON.stringify(this.dataForm.peEngineerList));
        this.peEngineerFlag=true
      },

      savepeEngineerList(){

        let peEngineerName='';
        for (let i = 0; i < this.peEngineerList.length; i++) {
          let select= this.operatorList.filter(item => item.operatorId === this.peEngineerList[i])
          if(select.length>0){
            peEngineerName+=select[0].operatorName+';'
          }
        }
        this.dataForm.peEngineer=peEngineerName
        this.dataForm.peEngineerList=JSON.parse(JSON.stringify(this.peEngineerList));
        this.peEngineerFlag=false
      },

      cqeModal(){
        if(this.ifDisableFlag){
          return false
        }
        let inData={
          site:this.searchData.site,
        }
        searchOperatorWithSite(inData).then(({data}) => {
          this.operatorList=data.rows
        })
        this.cqeList = JSON.parse(JSON.stringify(this.dataForm.cqeList));
        this.cqeFlag=true
      },
      savecqeList(){
        let cqeName='';
        for (let i = 0; i < this.cqeList.length; i++) {
          let select= this.operatorList.filter(item => item.operatorId === this.cqeList[i])
          if(select.length>0){
            cqeName+=select[0].operatorName+';'
          }
        }
        this.dataForm.cqe=cqeName
        this.dataForm.cqeList=JSON.parse(JSON.stringify(this.cqeList));
        this.cqeFlag=false
      },
      saveData(){
        this.$confirm("是否保存基本信息？", '保存提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
        }).then(() => {
          updateBMRoutingDetail(this.dataForm).then(({data}) => {
            if (data && data.code === 0) {
              this.$message.success( '操作成功')
            } else {
              this.$message.error(data.msg)
            }
          })
        }).catch(() => {
          return
        })
      },
      chooseRoute(row){
        this.nowRoute=JSON.parse(JSON.stringify(row));
          switch (row.itemType) {
              case 'prepress':
                this.selectedComponent='prepress';
                let prepressData=JSON.parse(JSON.stringify(this.searchData))
                prepressData.type='prepress'
                prepressData.ifDisableFlag=true
                this.$nextTick (()=>{this.$refs.routeRef.init(prepressData)});
                break;
              case 'printing':
                this.selectedComponent='printing';
                let printing=JSON.parse(JSON.stringify(this.searchData))
                printing.type='printing'
                printing.ifDisableFlag=true
                this.$nextTick (()=>{this.$refs.routeRef.init(printing)});
                break;
              case 'printOther':
                this.selectedComponent='printOther';
                let printOther=JSON.parse(JSON.stringify(this.searchData))
                printOther.type='printOther'
                printOther.ifDisableFlag=true
                this.$nextTick (()=>{this.$refs.routeRef.init(printOther)});
                break;
              case 'overprinting':
                this.selectedComponent='overprinting';
                let overprinting=JSON.parse(JSON.stringify(this.searchData))
                overprinting.type='overprinting'
                overprinting.ifDisableFlag=true
                this.$nextTick (()=>{this.$refs.routeRef.init(overprinting)});
                break;
              case 'slitting':
                this.selectedComponent='slitting';
                let slitting=JSON.parse(JSON.stringify(this.searchData))
                slitting.type='slitting'
                slitting.ifDisableFlag=true
                this.$nextTick (()=>{this.$refs.routeRef.init(slitting)});
                break;
              case 'lamTemperature':
                this.selectedComponent='lamTemperature';
                let lamTemperature=JSON.parse(JSON.stringify(this.searchData))
                lamTemperature.type='lamTemperature'
                lamTemperature.ifDisableFlag=true
                this.$nextTick (()=>{this.$refs.routeRef.init(lamTemperature)});
                break;
              case 'cutting':
                this.selectedComponent='cutting';
                let cutting=JSON.parse(JSON.stringify(this.searchData))
                cutting.type='cutting'
                cutting.ifDisableFlag=true
                this.$nextTick (()=>{this.$refs.routeRef.init(cutting)});
                break;
              case 'InkMixing':
                this.selectedComponent='InkMixing';
                let InkMixing=JSON.parse(JSON.stringify(this.searchData))
                InkMixing.type='InkMixing'
                InkMixing.ifDisableFlag=true
                this.$nextTick (()=>{this.$refs.routeRef.init(InkMixing)});
                break;
              case 'InkFormulation':
                this.selectedComponent='InkFormulation';
                let InkFormulation=JSON.parse(JSON.stringify(this.searchData))
                InkFormulation.type='InkFormulation'
                InkFormulation.ifDisableFlag=true
                this.$nextTick (()=>{this.$refs.routeRef.init(InkFormulation)});
                break;
              case 'lamination':
                this.selectedComponent='lamination';
                let lamination=JSON.parse(JSON.stringify(this.searchData))
                lamination.type='lamination'
                lamination.ifDisableFlag=true
                this.$nextTick (()=>{this.$refs.routeRef.init(lamination)});
                break;
              case 'CNC':
                this.selectedComponent='CNC';
                let CNC=JSON.parse(JSON.stringify(this.searchData))
                CNC.type='CNC'
                CNC.ifDisableFlag=true
                this.$nextTick (()=>{this.$refs.routeRef.init(CNC)});
                break;
              case 'Cut':
                this.selectedComponent='Cut';
                let inData=JSON.parse(JSON.stringify(this.searchData))
                inData.type='Cut'
                inData.ifDisableFlag=true
                this.$nextTick (()=>{this.$refs.routeRef.init(inData)});
                break;
              case 'packagePage':
                this.selectedComponent='packagePage';
                let packagePage=JSON.parse(JSON.stringify(this.searchData))
                packagePage.type='packagePage'
                packagePage.ifDisableFlag=true
                this.$nextTick (()=>{this.$refs.routeRef.init(packagePage)});
                break;
              case 'fqc':
                this.selectedComponent='fqc';
                let fqc=JSON.parse(JSON.stringify(this.searchData))
                fqc.type='fqc'
                fqc.ifDisableFlag=true
                this.$nextTick (()=>{this.$refs.routeRef.init(fqc)});
                break;
              case 'cqc':
                this.selectedComponent='cqc';
                let cqc=JSON.parse(JSON.stringify(this.searchData))
                cqc.type='cqc'
                cqc.ifDisableFlag=true
                this.$nextTick (()=>{this.$refs.routeRef.init(cqc)});
                break;
              case 'printFlexo':
                this.selectedComponent='printFlexo';
                let printFlexo=JSON.parse(JSON.stringify(this.searchData))
                printFlexo.type='printFlexo'
                printFlexo.ifDisableFlag=true
                this.$nextTick (()=>{this.$refs.routeRef.init(printFlexo)});
                break;
              case 'printIndigo':
                this.selectedComponent='printIndigo';
                let printIndigo=JSON.parse(JSON.stringify(this.searchData))
                printIndigo.type='printIndigo'
                printIndigo.ifDisableFlag=true
                this.$nextTick (()=>{this.$refs.routeRef.init(printIndigo)});
                break;
              default :
                this.selectedComponent=null;
                break;
          }
      },
      searchDetailTable(){
        searchRouteDetail(this.routeData).then(({data}) => {
          this.routeDetailList=data.rows;
        });
      },
      changeRouteRev(){
        this.searchDetailTable()
        this.currentRoute=null
        this.modalFlag=true;

      },
      getRow(row){
        this.currentRoute=row
      },
      updateBMProcess(){
        updateBMProcess(this.sheetData).then(({data}) => {
          if (data && data.code === 0) {
            this.$clearHighLight()
            tsdBasicInformationSearch(this.searchData).then(({data}) => {
              if(data.row){
                this.sheetData=data.row
              }else {

              }

            });
            this.$message.success('操作成功')
          } else {
            this.$message.error(data.msg)
          }
        })
      },
      updateBMRouteRev(){

        if(this.currentRoute==null){
          this.$alert('请点击选择Route版本！', '错误', {
            confirmButtonText: '确定'
          })
          return false;
        }
        if(this.currentRoute.status!=='Buildable'){
          this.$alert('只有Buildable状态的可以保存！', '错误', {
            confirmButtonText: '确定'
          })
          return false;
        }
        let inData={
          site:this.routeData.site,
          codeNo:this.searchData.codeNo,
          routingType:this.currentRoute.routingType,
          routingRevision:this.currentRoute.routingRevision,
          routingAlternativeNo:this.currentRoute.alternativeNo
        }
        this.$confirm("更改工艺路线后，之前填写的工艺信息都将覆盖，是否继续？", '保存提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
        }).then(() => {
          updateBMRouteRev(inData).then(({data}) => {
            if (data && data.code === 0) {
              this.searchTable();
              this.modalFlag = false;
              this.$message.success('操作成功')
            } else {
              this.$message.error(data.msg)
            }
          })
        })
      },
      jumpRoute(){
        if(this.routeData.routingRevision!=null||this.routeData.routingRevision!==''){
          this.$message.error("route明细不存在")
        }
        let inData={
          site:this.searchData.site,
          partNo:this.routeData.partNo,
          routingType:this.routeData.routingType,
          routingRevision:this.routeData.routingRevision,
        }
        localStorage.setItem('routeData', JSON.stringify(inData))
        window.open('#/part-routingManagement');

      },
      // 获取流程的配置权限
      getNodeAuthority (row) {
        getBMStatusDesc(this.searchData).then(({data}) => {
          this.superAdmin=data.superAdmin
          if(data.superAdmin){
            this.ifDisableFlag = false
            return false
          }
          if (data.status === '已完成' || data.status === '已升版') {
            this.ifDisableFlag = true
            return false
          }
          if(data.status === '审批中') {
            let tempData = {
              site: row.site,
              stepId: row.stepId,
              menuId: '103002'
            }
            getNodeAuthority(tempData).then(({data}) => {
              if (data && data.code === 0) {
                this.ifDisableFlag = true
                let plmStepRoleBaseBm = data.rows.plm_stepRole_base_bm
                let arr = plmStepRoleBaseBm.filter(a => a.fieldId === this.searchData.fieldId)
                if (arr.length > 0) {
                  if (arr[0].updateFlag === 'N') {
                    this.ifDisableFlag = true
                  } else {
                    this.ifDisableFlag = false
                  }
                } else {
                  this.ifDisableFlag = true
                }
              }
            })
          }
        })
      },
      // 打开提交模态框
      submitDataModal () {
        this.rejectOpinion = ''
        this.submitModalFlag = true
      },
      // 同意提交
      agreeSubmit () {
        this.$confirm(`是否确认提交?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let tempData = {
            site: this.searchData.site,
            userName: this.$store.state.user.name,
            codeNo: this.searchData.codeNo,
            menuId: '103002',
            nodeConclusion: 'Y'
          }
          this.submitData(tempData)
        })
      },

      // 驳回提交
      rejectSubmit () {
        this.$confirm(`是否确认驳回?`, '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          let tempData = {
            site: this.searchData.site,
            userName: this.$store.state.user.name,
            codeNo: this.searchData.codeNo,
            menuId: '103002',
            nodeConclusion: 'N',
            rejectOpinion : this.rejectOpinion
          }
          this.submitData(tempData)
        })
      },
      async submitData (tempData) {
       await  updateBMProcess(this.sheetData).then(({data}) => {
          if (data && data.code === 0) {
            tsdBasicInformationSearch(this.searchData).then(({data}) => {
              if(data.row){
                this.sheetData=data.row
              }else {

              }

            });
          } else {
            this.$message.error(data.msg)
            return false
          }
        })
        await  updateBMRoutingDetail(this.dataForm).then(({data}) => {
          if (data && data.code === 0) {
          } else {
            this.$message.error(data.msg)
            return false
          }
        })
        await submitChange(tempData).then(({data}) => {
          if (data && data.code === 0) {
            this.searchTable();
            this.submitModalFlag = false
            this.$message({message: '操作成功', type: 'success'})
          } else {
            this.$alert(data.msg, '错误', {
              confirmButtonText: '确定'
            })
          }
        })


      },
      //关闭模态框后刷新下方预览 重新加载组件
      closeItemModel(){
        this.componentKey=Number( this.componentKey)+1
        this.chooseRoute(this.nowRoute)
      },
    },
  }
</script>

<style scoped>

</style>
