<template>
  <div class="mod-config">
    <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
      <el-form-item >
        <span slot="label" style="" @click="getSearchModal()"><a herf="#">物料编码：</a></span>
        <el-input v-model="mainData.partNo" readonly   style="width: 130px"></el-input>
      </el-form-item>
      <el-form-item :label="'物料名称/规格型号：'">
        <el-input v-model="mainData.spec"  readonly style="width: 274px"></el-input>
      </el-form-item>
      <el-form-item :label="'状态：'">
        <el-input v-model="mainData.status"  readonly style="width: 130px"></el-input>
      </el-form-item>
      <el-form-item :label="'工厂编号：'">
        <el-input v-model="mainData.site"  readonly style="width: 130px"></el-input>
        <el-button @click="getPartDetail()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'物料信息'}}</el-button>
        <el-button @click="changeStatus()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'更改状态'}}</el-button>
      </el-form-item>
    </el-form>
    <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
      <el-form-item :label="'工艺路线类型：'">
        <el-input v-model="mainData.routingType" readonly  style="width: 130px"></el-input>
      </el-form-item>
      <el-form-item :label="'版本号：'">
        <el-input v-model="mainData.revNo"  readonly style="width: 130px"></el-input>
      </el-form-item>
      <el-form-item :label="'启用日期：'">
        <el-input v-model="mainData.phaseInDate"  readonly style="width: 130px"></el-input>
      </el-form-item>
      <el-form-item :label="'停用日期：'">
        <el-input v-model="mainData.phaseOutDate"  readonly style="width: 130px"></el-input>
      </el-form-item>
      <el-form-item :label="'计量单位：'">
        <el-input v-model="mainData.umid" readonly  style="width: 130px"></el-input>
        <el-button @click="tongBuOrder()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'同步工艺路线到订单'}}</el-button>
      </el-form-item>
    </el-form>
    <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
      <el-form-item :label="'备注：'">
        <el-input v-model="mainData.remark"  readonly style="width: 417px"></el-input>
<!--        <el-checkbox style="margin-left: 20px" disabled v-model="mainData.defaultflag">默认</el-checkbox>-->
<!--        <el-checkbox style="margin-left: 80px" disabled v-model="mainData.repairFlag">修复版本</el-checkbox>-->
      </el-form-item>
      <el-form-item :label="'默认：'">
        <el-checkbox style="margin-left: 0px" disabled v-model="mainData.defaultflag"></el-checkbox>
      </el-form-item>
      <el-form-item :label="'修复版本：'" style="margin-left: 20px">
        <el-checkbox style="margin-left: 0px" disabled v-model="mainData.repairFlag"></el-checkbox>
        <el-button @click="setDefault()" type="primary" style="margin-left: 58px;margin-top: 0px">{{'设为默认'}}</el-button>
        <el-button @click="copyRouting()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'复制产品工艺路线'}}</el-button>
      </el-form-item>
    </el-form>
    <el-tabs v-model="activeName" >
      <el-tab-pane :label="'明细'" name="first">
        <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
          <el-button @click="addRoutingDetail()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'新增'}}</el-button>
          <el-button @click="editRoutingDetail()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'修改'}}</el-button>
          <el-button @click="deleteRoutingDetail()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'删除'}}</el-button>
          <el-button @click="jumpWorkCenter()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'加工中心'}}</el-button>
          <el-button @click="getResourceModel()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'可用机台'}}</el-button>
        </el-form>
        <el-table
          :height="height"
          :data="dataList2"
          border
          @row-click="clickData"
          highlight-current-row
          v-loading="dataListLoading"
          style="width: 100%;">
          <el-table-column
            v-for="(item,index) in columnList2" :key="index"
            :sortable="item.columnSortable"
            :prop="item.columnProp"
            :header-align="item.headerAlign"
            :show-overflow-tooltip="item.showOverflowTooltip"
            :align="item.align"
            :fixed="item.fixed"
            :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>
      </el-tab-pane>
      <el-tab-pane :label="'工具清单'" name="second">
        <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
          <el-button @click="addRoutingTool()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'新增'}}</el-button>
          <el-button @click="editRoutingTool()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'修改'}}</el-button>
          <el-button @click="deleteRoutingTool()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'删除'}}</el-button>
          <el-button @click="jumpToolInfo()" type="primary" style="margin-left: 2px;margin-top: 0px">{{'工具信息'}}</el-button>
        </el-form>
        <el-table
          :height="height"
          :data="dataList3"
          border
          @row-click="clickData2"
          highlight-current-row
          v-loading="dataListLoading"
          style="width: 100%;">
          <el-table-column
            v-for="(item,index) in columnList3" :key="index"
            :sortable="item.columnSortable"
            :prop="item.columnProp"
            :header-align="item.headerAlign"
            :show-overflow-tooltip="item.showOverflowTooltip"
            :align="item.align"
            :fixed="item.fixed"
            :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>
      </el-tab-pane>
    </el-tabs>
    <el-dialog title="数据表" :close-on-click-modal="false" v-drag :visible.sync="modelFlag" width="680px" >
      <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: 0px;">
        <el-form-item :label="'物料编码：'">
          <el-input v-model="searchPartNo" style="width: 130px"></el-input>
          <el-button @click="searchRoutingWithPartNo()" type="primary">查询</el-button>
          <el-button @click="addRoutingHeaderModel()" type="primary">新增</el-button>
        </el-form-item>
      </el-form>
      <el-table
        height="300"
        :data="dataList"
        border
        @row-dblclick="tableHanddle"
        v-loading="dataListLoading"
        style="width: 100%;">
        <el-table-column
          header-align="center"
          align="center"
          width="150"
          label="操作">
          <template slot-scope="scope">
            <a type="text" size="small" @click="editRoutingHeaderModel(scope.row)">修改</a>
            <a type="text" size="small" @click="deleteRoutingHeaderData(scope.row)">删除</a>
          </template>
        </el-table-column>
        <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"
          :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>
      <el-footer  style="height:40px;margin-top: 20px;text-align:center">
        <el-button type="primary" @click="modelFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>
    <el-dialog title="维护工艺路线明细" :close-on-click-modal="false" v-drag :visible.sync="detailmodelFlag" width="620px">
      <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: 0px;">
        <el-form-item :label="'工序号：'">
          <el-input v-model="detailData.itemNo" :disabled="detailmodelInputFlag"  style="width: 130px;text-align: right" type="number"></el-input>
        </el-form-item>
        <el-form-item :label="'工序名称：'">
          <el-input v-model="detailData.operationDesc" style="width: 130px"></el-input>
        </el-form-item>
        <el-form-item >
          <span slot="label" style="" @click="getBaseList(24,0)"><a herf="#">加工中心编码：</a></span>
          <el-input v-model="detailData.workCenterNo" style="width: 130px"></el-input>
        </el-form-item>
        <el-form-item :label="'准备时间：'">
          <el-input v-model="detailData.machSetupTime" style="width: 130px"></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: 0px;">
        <el-form-item :label="'单位产出量：'">
          <el-input v-model="detailData.machRunFactor" type="number" style="width: 130px"></el-input>
        </el-form-item>
        <el-form-item :label="'产出单位：'">
          <el-select filterable v-model="detailData.factorUnit" style="width: 130px">
            <el-option label="" value=""></el-option>
            <el-option label="单位/小时" value="单位/小时"></el-option>
            <el-option label="小时" value="小时"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="'计价单价：'">
          <el-input v-model="detailData.jjgzUnitPrice" type="number" style="width: 130px"></el-input>
        </el-form-item>
        <el-form-item :label="'单位：'">
          <el-select filterable v-model="detailData.jjgzUnitFactor" style="width: 130px">
            <el-option label="" value=""></el-option>
            <el-option label="小时" value="小时"></el-option>
            <el-option label="件" value="件"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: 0px;">
        <el-form-item :label="'效率：'">
          <el-input v-model="detailData.efficiency" type="number" style="width: 130px"></el-input>
        </el-form-item>
        <el-form-item :label="'操作工人数：'">
          <el-input v-model="detailData.crewsize" type="number" style="width: 130px"></el-input>
        </el-form-item>
        <el-form-item :label="'备注：'">
          <el-input v-model="detailData.remark" style="width: 130px"></el-input>
        </el-form-item>
      </el-form>
      <el-footer  style="height:40px;margin-top: 20px;text-align:center">
        <el-button type="primary" @click="saveRoutingDetailData()">保存</el-button>
        <el-button type="primary" @click="detailmodelFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>
    <el-dialog title="维护工艺路线工具" :close-on-click-modal="false" v-drag :visible.sync="ToolmodelFlag" width="480px">
      <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: 0px;">
        <el-form-item :label="'工序号：'">
          <el-select v-model="toolData.itemNo" @change="getOperationDesc()" :disabled="toolmodelInputFlag" style="width: 130px" placeholder="请选择">
            <el-option
              v-for="(item,index) in selectList"
              :key="index"
              :label="item.label"
              :value="item.value"
            >
            </el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="'工序名称：'">
          <el-input v-model="toolData.operationDesc" disabled  style="width: 130px;text-align: right" ></el-input>
        </el-form-item>
        <el-form-item >
          <span slot="label" style="" @click="getBaseList(70,0)"><a herf="#">工具编号：</a></span>
          <el-input v-model="toolData.toolID" @change="getToolDesc()" :disabled="toolmodelInputFlag" style="width: 130px;text-align: right" ></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: 0px;">
        <el-form-item :label="'工具名称：'">
          <el-input v-model="toolData.toolDescription"  disabled  style="width: 130px;text-align: right" ></el-input>
        </el-form-item>
        <el-form-item :label="'规格型号：'">
          <el-input v-model="toolData.spec" disabled  style="width: 275px;text-align: right" ></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: 0px;">
        <el-form-item :label="'工具数量：'">
          <el-input v-model="toolData.toolQty"   style="width: 130px;text-align: right" type="number"></el-input>
        </el-form-item>
        <el-form-item :label="'备注：'">
          <el-input v-model="toolData.remark"   style="width: 275px;text-align: right" ></el-input>
        </el-form-item>
      </el-form>
      <el-footer  style="height:40px;margin-top: 20px;text-align:center">
        <el-button type="primary" @click="saveRoutingTool()">保存</el-button>
        <el-button type="primary" @click="ToolmodelFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>
    <el-dialog title="可用机台" :close-on-click-modal="false" v-drag :visible.sync="routingModelFlag" width="800px">
      <el-container>
        <el-main style="width: 300px">
          <span  style="" >可选机台：</span>
          <el-table
          height="300px"
          :data="resourceList1"
          border
          @row-click="clickData3"
          highlight-current-row
          v-loading="dataListLoading"
          style="width: 100%">
          <el-table-column
            v-for="(item,index) in columnList4" :key="index"
            :sortable="item.columnSortable"
            :prop="item.columnProp"
            :header-align="item.headerAlign"
            :show-overflow-tooltip="item.showOverflowTooltip"
            :align="item.align"
            :fixed="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>
        </el-main>
        <el-main style="width: 100px">
          <div style="margin-top: 100px">
            <el-button type="primary" @click="addResource()">添加机台>></el-button>
          </div>
          <div style="margin-top: 20px">
            <el-button type="primary" @click="deleteResource()">删除机台<<</el-button>
          </div>
        </el-main>
        <el-main style="width: 300px">
          <span  style="" >已选机台：</span>
          <el-table
          height="300px"
          :data="resourceList2"
          border
          @row-click="clickData4"
          highlight-current-row
          v-loading="dataListLoading"
          style="width: 100%">
          <el-table-column
            v-for="(item,index) in columnList5" :key="index"
            :sortable="item.columnSortable"
            :prop="item.columnProp"
            :header-align="item.headerAlign"
            :show-overflow-tooltip="item.showOverflowTooltip"
            :align="item.align"
            :fixed="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>
        </el-main>
      </el-container>
<!--      <el-footer  style="height:40px;margin-top: 20px;text-align:center">-->
<!--        <el-button type="primary" @click="routingModelFlag = false">关闭</el-button>-->
<!--      </el-footer>-->
    </el-dialog>
    <el-dialog title="物料信息" :close-on-click-modal="false" v-drag :visible.sync="partFlag" width="630px" >
      <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item :label="'物料编码：'">
          <el-input v-model="partData.partNo" readonly style="width: 130px"></el-input>
        </el-form-item>
        <el-form-item :label="'物料名称：'">
          <el-input v-model="partData.partDescription" readonly style="width: 260px"></el-input>
        </el-form-item>
        <el-form-item :label="'工厂编号：'">
          <el-input v-model="partData.site" readonly style="width: 130px"></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item :label="'新增日期：'">
          <el-input v-model="partData.createDate" readonly style="width: 130px"></el-input>
        </el-form-item>
        <el-form-item :label="'计量单位：'">
          <el-input v-model="partData.umid" readonly style="width: 130px"></el-input>
        </el-form-item>
        <el-form-item :label="'在用：'" style="margin-left: 130px">
          <el-input v-model="partData.active" readonly style="width: 130px;"></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" style="margin-left: 7px;margin-top: -5px;">
        <el-form-item :label="'客户名称：'">
          <el-input v-model="partData.configurationTemplateID" readonly style="width: 130px"></el-input>
        </el-form-item>
        <el-form-item :label="'客户产品科号：'">
          <el-input v-model="partData.remark" readonly style="width: 260px"></el-input>
        </el-form-item>
      </el-form>
      <el-footer  style="height:40px;margin-top: 20px;text-align:center">
        <el-button type="primary" @click="partFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>
    <el-dialog title="更改状态" :close-on-click-modal="false" v-drag :visible.sync="statusFlag" width="240px" >
      <el-form :inline="true" label-position="top" style="margin-left: 0px;margin-top: -5px;">
        <el-form-item :label="'状态：'" style="margin-left: 48px">
          <el-select v-model="status" style="width: 120px">
            <el-option label="试验" value="试验"></el-option>
            <el-option label="投产" value="投产"></el-option>
            <el-option label="停用" value="停用"></el-option>
          </el-select>
        </el-form-item>
        <el-footer  style="height:40px;margin-top: 20px;text-align:center">
          <el-button type="primary" @click="saveStatus()">保存</el-button>
          <el-button type="primary" @click="statusFlag = false">关闭</el-button>
        </el-footer>
      </el-form>
    </el-dialog>
    <el-dialog title="复制产品工艺路线" :close-on-click-modal="false" v-drag :visible.sync="copyRoutingModelFlag" width="600px" >
      <el-container>
        <el-main style="width: 450px;margin-top: -20px">
          <fieldset style="margin-left: 0px; margin-top: 0px; width: 420px;">
            <legend>源产品工艺路线</legend>
            <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: -8px;">
              <el-form-item :label="'工艺路线编码：'">
                <el-input v-model="copyRoutingData.partNo" disabled  style="width: 120px;text-align: right" ></el-input>
              </el-form-item>
              <el-form-item :label="'工艺路线名称：'">
                <el-input v-model="copyRoutingData.partDescription" disabled  style="width: 250px;text-align: right" ></el-input>
              </el-form-item>
            </el-form>
            <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: -0px;">
              <el-form-item :label="'版本号：'">
                <el-input v-model="copyRoutingData.revNo" disabled  style="width: 120px;text-align: right" ></el-input>
              </el-form-item>
              <el-form-item :label="'启用日期：'">
                <el-input v-model="copyRoutingData.phaseInDate" disabled  style="width: 120px;text-align: right" ></el-input>
              </el-form-item>
              <el-form-item :label="'修复版本：'">
                <el-checkbox style="margin-left: 0px" disabled v-model="copyRoutingData.repairFlag"></el-checkbox>
              </el-form-item>
            </el-form>
          </fieldset>
          <fieldset style="margin-left: 0px; margin-top: 0px; width: 420px;">
            <legend>新产品工艺路线</legend>
            <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: -8px;">
              <el-form-item >
                <span slot="label" style="" @click="getBaseList(5,1)"><a herf="#">工艺路线编码：</a></span>
                <el-input v-model="copyRoutingData.partNo1" @change="getPartDescription()"  style="width: 120px;text-align: right" ></el-input>
              </el-form-item>
              <el-form-item :label="'工艺路线名称：'">
                <el-input v-model="copyRoutingData.partDescription1" disabled  style="width: 250px;text-align: right" ></el-input>
              </el-form-item>
            </el-form>
            <el-form :inline="true" label-position="top" label-width="100px" style="margin-top: -0px;">
              <el-form-item :label="'版本号：'">
                <el-input v-model="copyRoutingData.revNo1"   style="width: 120px;text-align: right" ></el-input>
              </el-form-item>
              <el-form-item :label="'启用日期：'">
                <el-date-picker
                  style="width: 130px"
                  v-model="copyRoutingData.phaseInDate1"
                  value-format="yyyy-MM-dd"
                  placeholder="选择日期">
                </el-date-picker>
              </el-form-item>
              <el-form-item :label="'修复版本：'">
                <el-checkbox style="margin-left: 0px"  v-model="copyRoutingData.repairFlag1"></el-checkbox>
              </el-form-item>
            </el-form>
          </fieldset>
        </el-main>
        <el-main style="width: 140px">
          <div style="width: 115px;">
          <el-checkbox style="margin-left: 0px"  v-model="copyRoutingData.oldFlag"></el-checkbox>
            <span style="font-size: 11px">自动停用早期所有版本 </span>
          </div>
          <div>
            <span style="font-size: 11px;width: 115px">
              (仅用于相同产品版本升级的时候)
            </span>
          </div>
          <div style="width: 115px;margin-top: 15px">
          <el-checkbox style="margin-left: 0px"  v-model="copyRoutingData.toolFlag"></el-checkbox>
            <span style="font-size: 11px">复制工具信息 </span>
          </div>
          <div style="width: 115px;margin-top: 15px">
          <el-checkbox style="margin-left: 0px"  v-model="copyRoutingData.resourceFlag"></el-checkbox>
            <span style="font-size: 11px">复制可用机台 </span>
          </div>
        </el-main>
      </el-container>
      <el-footer  style="height:40px;margin-top: 0px;text-align:center">
        <el-button type="primary" @click="saveCopyRouting()">保存</el-button>
        <el-button type="primary" @click="copyRoutingModelFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>
    <el-dialog title="维护工艺路线" :close-on-click-modal="false" v-drag :visible.sync="routingHeaderModelFlag" width="480px" >
      <el-form :inline="true" label-position="top" style="margin-left: 0px;margin-top: -5px;">
        <el-form-item>
          <span slot="label" style="" @click="getBaseList(5,2)"><a herf="#">工艺路线编码：</a></span>
          <el-input v-model="routingHeaderData.partNo" :disabled="routingHeaderInputFlag"  style="width: 130px;text-align: right" ></el-input>
        </el-form-item>
        <el-form-item :label="'工厂编号：'">
          <el-input v-model="routingHeaderData.site" disabled  style="width: 130px;text-align: right" ></el-input>
        </el-form-item>
        <el-form-item :label="'状态：'">
          <el-input v-model="routingHeaderData.status" disabled  style="width: 130px;text-align: right" ></el-input>
        </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" style="margin-left: 0px;margin-top: -5px;">
      <el-form-item :label="'版本号：'">
        <el-input v-model="routingHeaderData.revNo" :disabled="routingHeaderInputFlag"  style="width: 130px;text-align: right" ></el-input>
      </el-form-item>
      <el-form-item :label="'启用日期：'">
        <el-date-picker
          style="width: 130px"
          v-model="routingHeaderData.phaseInDate"
          value-format="yyyy-MM-dd"
          placeholder="选择日期">
        </el-date-picker>
      </el-form-item>
      <el-form-item :label="'停用日期：'">
        <el-date-picker
          style="width: 130px"
          v-model="routingHeaderData.phaseOutDate"
          value-format="yyyy-MM-dd"
          placeholder="选择日期">
        </el-date-picker>
      </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" style="margin-left: 0px;margin-top: -5px;">
      <el-form-item :label="'工艺路线类型：'">
        <el-input v-model="routingHeaderData.routingType"  disabled style="width: 130px;text-align: right" ></el-input>
      </el-form-item>
      <el-form-item :label="'备注：'">
        <el-input v-model="routingHeaderData.remark"   style="width: 275px;text-align: right" ></el-input>
      </el-form-item>
      </el-form>
      <el-form :inline="true" label-position="top" style="margin-left: 0px;margin-top: -5px;">
        <el-form-item :label="'默认：'">
          <el-select v-model="routingHeaderData.defaultflag"  :disabled="routingHeaderInputFlag"  style="width: 130px">
            <el-option label="是" value="Y"></el-option>
            <el-option label="否" value="N"></el-option>
          </el-select>
        </el-form-item>
        <el-form-item :label="'修复版本：'">
          <el-select v-model="routingHeaderData.repairFlag" style="width: 130px">
            <el-option label="是" value="Y"></el-option>
            <el-option label="否" value="N"></el-option>
          </el-select>
        </el-form-item>
      </el-form>
      <el-footer  style="height:40px;margin-top: 20px;text-align:center">
        <el-button type="primary" @click="saveRoutingHeaderData()">保存</el-button>
        <el-button type="primary" @click="routingHeaderModelFlag = false">关闭</el-button>
      </el-footer>
    </el-dialog>
    <Chooselist ref="baseList"  @getBaseData="getBaseData"></Chooselist>
  </div>
</template>

<script>
  import {
    searchRoutingWithPartNo,
    searchRoutingDetailData,
    saveRoutingDetailData,
    deleteRoutingDetail,
    searchRoutingToolData,
    searchUsedResource,
    searchAllResource,
    addRoutingResource,
    deleteRoutingResource,
    getItemSelect,
    getToolDesc,
    saveRoutingTool,
    deleteRoutingTool,
    searchPartNoData,
    changeRoutingStatus,
    checkRoutingAndOrder,
    changeOrderRouting,
    saveCopyRouting,
    setDefault,
    saveRoutingHeaderData,
    deleteRoutingHeaderData
  }from "@/api/base/site.js"
  import Chooselist from '@/views/modules/common/Chooselist'
    export default {
      name: "maintainProductRouting",
      components: {
        Chooselist
      },
      data () {
        return {
          routingHeaderInputFlag:false,
          routingHeaderModelFlag:false,
          routingHeaderData:{
            partNo:'',
            site:'',
            status:'',
            revNo:'',
            phaseInDate:'',
            phaseOutDate:'',
            routingType:'',
            remark:'',
            defaultflag:'',
            repairFlag:'',
            add:'',
          },
          selectList:[],
          resourceList1:[],
          resourceList2:[],
          currentRow4:null,
          currentRow3:null,
          currentRow2:null,
          currentRow:null,
          tagNo:'',
          status:'',
          dataListLoading: false,
          searchPartNo:'',
          height:200,
          mainData:{
            partNo:'',
            spec:'',
            status:'',
            site:'',
            routingType:'',
            revNo:'',
            phaseInDate:'',
            phaseOutDate:'',
            umid:'',
            remark:'',
            defaultflag:'',
            repairFlag:'',
          },
          partData:{
            partNo:'',
            partDescription:'',
            site:'',
            createDate:'',
            umid:'',
            active:'',
            configurationTemplateID:'',
            modelFlag:'',
          },
          copyRoutingData:{
            partNo:'',
            partDescription:'',
            revNo:'',
            phaseInDate:'',
            repairFlag:'',
            partNo1:'',
            partDescription1:'',
            revNo1:'',
            phaseInDate1:'',
            repairFlag1:false,
            oldFlag:false,
            toolFlag:false,
            resourceFlag:false,
          },
          activeName:'first',
          modelFlag:false,
          ToolmodelFlag:false,
          detailmodelFlag:false,
          detailmodelInputFlag:false,
          toolmodelInputFlag:false,
          copyRoutingModelFlag:false,
          partFlag:false,
          statusFlag:false,
          dataList:[],
          dataList2:[],
          dataList3:[],
          toolData:{
            site:'',
            partNo:'',
            revNo:'',
            itemNo:'',
            operationDesc:'',
            toolID:'',
            toolDescription:'',
            spec:'',
            toolQty:'',
            remark:'',
            user:'',
            add:'',
          },
          columnList:[
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040TablePartNo',
              tableId: "6040Table",
              tableName: "维护工艺路线数据表",
              columnProp: "partNo",
              headerAlign: "center",
              align: "left",
              columnLabel: "物料编码",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 100
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040TableSpec',
              tableId: "6040Table",
              tableName: "维护工艺路线数据表",
              columnProp: "spec",
              headerAlign: "center",
              align: "left",
              columnLabel: "名称/规格",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 120
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040TableRoutingType',
              tableId: "6040Table",
              tableName: "维护工艺路线数据表",
              columnProp: "routingType",
              headerAlign: "center",
              align: "left",
              columnLabel: "工艺路线类型",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 80
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040TableRevNo',
              tableId: "6040Table",
              tableName: "维护工艺路线数据表",
              columnProp: "revNo",
              headerAlign: "center",
              align: "left",
              columnLabel: "版本号",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 60
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040TablePhaseInDate',
              tableId: "6040Table",
              tableName: "维护工艺路线数据表",
              columnProp: "phaseInDate",
              headerAlign: "center",
              align: "left",
              columnLabel: "启用日期",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 80
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040TablePhaseOutDate',
              tableId: "6040Table",
              tableName: "维护工艺路线数据表",
              columnProp: "phaseOutDate",
              headerAlign: "center",
              align: "left",
              columnLabel: "停用日期",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 80
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040TableStatus',
              tableId: "6040Table",
              tableName: "维护工艺路线数据表",
              columnProp: "status",
              headerAlign: "center",
              align: "left",
              columnLabel: "状态",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 40
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040TableSite',
              tableId: "6040Table",
              tableName: "维护工艺路线数据表",
              columnProp: "site",
              headerAlign: "center",
              align: "left",
              columnLabel: "工厂编码",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 60
            },
          ],
          columnList2:[
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table2ItemNo',
              tableId: "6040Table2",
              tableName: "维护工艺路线工序表",
              columnProp: "itemNo",
              headerAlign: "center",
              align: "right",
              columnLabel: "工序号",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 60
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table2OperationDesc',
              tableId: "6040Table2",
              tableName: "维护工艺路线工序表",
              columnProp: "operationDesc",
              headerAlign: "center",
              align: "left",
              columnLabel: "工序名称",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 300
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table2WorkCenterNo',
              tableId: "6040Table2",
              tableName: "维护工艺路线工序表",
              columnProp: "workCenterNo",
              headerAlign: "center",
              align: "left",
              columnLabel: "加工中心编码",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 100
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table2WorkCenterDesc',
              tableId: "6040Table2",
              tableName: "维护工艺路线工序表",
              columnProp: "workCenterDesc",
              headerAlign: "center",
              align: "left",
              columnLabel: "加工中心名称",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 100
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table2MachSetupTime',
              tableId: "6040Table2",
              tableName: "维护工艺路线工序表",
              columnProp: "machSetupTime",
              headerAlign: "center",
              align: "right",
              columnLabel: "准备时间(小时)",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 100
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table2MachRunFactor',
              tableId: "6040Table2",
              tableName: "维护工艺路线工序表",
              columnProp: "machRunFactor",
              headerAlign: "center",
              align: "right",
              columnLabel: "单位产出量",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 100
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table2FactorUnit',
              tableId: "6040Table2",
              tableName: "维护工艺路线工序表",
              columnProp: "factorUnit",
              headerAlign: "center",
              align: "left",
              columnLabel: "产出单位",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 100
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table2Efficiency',
              tableId: "6040Table2",
              tableName: "维护工艺路线工序表",
              columnProp: "efficiency",
              headerAlign: "center",
              align: "right",
              columnLabel: "效率(%)",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 80
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table2Remark',
              tableId: "6040Table2",
              tableName: "维护工艺路线工序表",
              columnProp: "remark",
              headerAlign: "center",
              align: "left",
              columnLabel: "备注",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 160
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table2JJGZUnitPrice',
              tableId: "6040Table2",
              tableName: "维护工艺路线工序表",
              columnProp: "jjgzUnitPrice",
              headerAlign: "center",
              align: "right",
              columnLabel: "每件计价",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 100
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table2JJGZUnitFactor',
              tableId: "6040Table2",
              tableName: "维护工艺路线工序表",
              columnProp: "jjgzUnitFactor",
              headerAlign: "center",
              align: "left",
              columnLabel: "计价单位",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 100
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table2Crewsize',
              tableId: "6040Table2",
              tableName: "维护工艺路线工序表",
              columnProp: "crewsize",
              headerAlign: "center",
              align: "left",
              columnLabel: "操作工人数",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 100
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table2WorkCenterType',
              tableId: "6040Table2",
              tableName: "维护工艺路线工序表",
              columnProp: "workCenterType",
              headerAlign: "center",
              align: "left",
              columnLabel: "加工中心类型",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 100
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table2WXPartNo',
              tableId: "6040Table2",
              tableName: "维护工艺路线工序表",
              columnProp: "wxPartNo",
              headerAlign: "center",
              align: "left",
              columnLabel: "费用结算料号",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 120
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table2WXSpec',
              tableId: "6040Table2",
              tableName: "维护工艺路线工序表",
              columnProp: "wxSpec",
              headerAlign: "center",
              align: "left",
              columnLabel: "费用结算物料名称/规格",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 250
            },


          ],
          columnList3:[
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table3RevNo',
              tableId: "6040Table3",
              tableName: "维护工艺路线工具表",
              columnProp: "revNo",
              headerAlign: "center",
              align: "left",
              columnLabel: "版本号",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 80
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table3ItemNo',
              tableId: "6040Table3",
              tableName: "维护工艺路线工具表",
              columnProp: "itemNo",
              headerAlign: "center",
              align: "right",
              columnLabel: "工序号",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 80
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table3ToolID',
              tableId: "6040Table3",
              tableName: "维护工艺路线工具表",
              columnProp: "toolID",
              headerAlign: "center",
              align: "left",
              columnLabel: "工具编号",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 150
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table3ToolDescription',
              tableId: "6040Table3",
              tableName: "维护工艺路线工具表",
              columnProp: "toolDescription",
              headerAlign: "center",
              align: "left",
              columnLabel: "工具名称",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 200
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table3Spec',
              tableId: "6040Table3",
              tableName: "维护工艺路线工具表",
              columnProp: "spec",
              headerAlign: "center",
              align: "left",
              columnLabel: "规格型号",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 150
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table3ToolQty',
              tableId: "6040Table3",
              tableName: "维护工艺路线工具表",
              columnProp: "toolQty",
              headerAlign: "center",
              align: "right",
              columnLabel: "工具数量",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 80
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table3Active',
              tableId: "6040Table3",
              tableName: "维护工艺路线工具表",
              columnProp: "active",
              headerAlign: "center",
              align: "left",
              columnLabel: "在用",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 60
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table3FamilyID',
              tableId: "6040Table3",
              tableName: "维护工艺路线工具表",
              columnProp: "familyID",
              headerAlign: "center",
              align: "left",
              columnLabel: "工具分类",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 100
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table3FamilyName',
              tableId: "6040Table3",
              tableName: "维护工艺路线工具表",
              columnProp: "familyName",
              headerAlign: "center",
              align: "left",
              columnLabel: "工具分类名称",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 150
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table3Remark',
              tableId: "6040Table3",
              tableName: "维护工艺路线工具表",
              columnProp: "remark",
              headerAlign: "center",
              align: "left",
              columnLabel: "备注",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 200
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table3CreateDate',
              tableId: "6040Table3",
              tableName: "维护工艺路线工具表",
              columnProp: "createDate",
              headerAlign: "center",
              align: "left",
              columnLabel: "录入日期",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 160
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table3CreatedBy',
              tableId: "6040Table3",
              tableName: "维护工艺路线工具表",
              columnProp: "createdBy",
              headerAlign: "center",
              align: "left",
              columnLabel: "录入人",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 100
            },
          ],
          columnList4:[
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table4ResourceID',
              tableId: "6040Table4",
              tableName: "维护工艺路线可用机台表",
              columnProp: "resourceID",
              headerAlign: "center",
              align: "left",
              columnLabel: "机台编码",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 70
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table4ResourceDesc',
              tableId: "6040Table4",
              tableName: "维护工艺路线可用机台表",
              columnProp: "resourceDesc",
              headerAlign: "center",
              align: "left",
              columnLabel: "机台名称",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 160
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table4Active',
              tableId: "6040Table4",
              tableName: "维护工艺路线可用机台表",
              columnProp: "active",
              headerAlign: "center",
              align: "left",
              columnLabel: "在用",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 50
            },
          ],
          columnList5:[
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table5ResourceID',
              tableId: "6040Table5",
              tableName: "维护工艺路线已选机台表",
              columnProp: "resourceID",
              headerAlign: "center",
              align: "left",
              columnLabel: "机台编码",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 70
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table5ResourceDesc',
              tableId: "6040Table5",
              tableName: "维护工艺路线已选机台表",
              columnProp: "resourceDesc",
              headerAlign: "center",
              align: "left",
              columnLabel: "机台名称",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 160
            },
            {
              userId: this.$store.state.user.name,
              functionId: 6040,
              serialNumber: '6040Table5Active',
              tableId: "6040Table5",
              tableName: "维护工艺路线已选机台表",
              columnProp: "active",
              headerAlign: "center",
              align: "left",
              columnLabel: "在用",
              columnHidden: false,
              columnImage: false,
              columnSortable: false,
              sortLv: 0,
              status: true,
              fixed: false,
              columnWidth: 50
            },
          ],
          routingModelFlag:false,
          detailData:{
            itemNo:'',
            operationDesc:'',
            workCenterNo:'',
            machSetupTime:'',
            machRunFactor:'',
            factorUnit:'',
            jjgzUnitPrice:'',
            jjgzUnitFactor:'',
            efficiency:'',
            crewsize:'',
            remark:'',
            site:'',
            partNo:'',
            revNo:'',
            add:'',
            user:'',
          },
          tagNo2:'',
        }
      },
      mounted() {
        this.$nextTick(() => {
          this.height = window.innerHeight - 310;
        })
      },
      methods: {
        editRoutingHeaderModel(row){
          this.routingHeaderData={
            partNo:row.partNo,
            site:row.site,
            status:row.status,
            revNo:row.revNo,
            phaseInDate:row.phaseInDate,
            phaseOutDate:row.phaseOutDate,
            routingType:row.routingType,
            remark:row.remark,
            defaultflag:row.defaultflag,
            repairFlag:row.repairFlag,
            add:1,
          };
          this.routingHeaderInputFlag=true;
          this.routingHeaderModelFlag=true;
        },
        addRoutingHeaderModel(){
          this.routingHeaderData={
            partNo:'',
            site:this.$store.state.user.site,
            status:'试验',
            revNo:'',
            phaseInDate:new Date(),
            phaseOutDate:null,
            routingType:'制造',
            remark:'',
            defaultflag:'Y',
            repairFlag:'N',
            add:0,
          };
          this.routingHeaderInputFlag=false;
          this.routingHeaderModelFlag=true;
        },
        saveRoutingHeaderData(){
          if(this.routingHeaderData.partNo==''||this.routingHeaderData.partNo==null){
            this.$alert("请输入工艺路线号！",'错误',{
              confirmButtonText:'确定'
            })
            return false;
          }
          if(this.routingHeaderData.revNo==''||this.routingHeaderData.revNo==null){
            this.$alert("请输入版本号！",'错误',{
              confirmButtonText:'确定'
            })
            return false;
          }
          if(this.routingHeaderData.phaseInDate==''||this.routingHeaderData.phaseInDate==null){
            this.$alert("请选择启用日期！",'错误',{
              confirmButtonText:'确定'
            })
            return false;
          }
          saveRoutingHeaderData(this.routingHeaderData).then(({data}) => {
            if (data && data.code == 200) {
              this.routingHeaderModelFlag = false
              this.searchRoutingWithPartNo();
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {
                }
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        },
        deleteRoutingHeaderData(row){
          this.$confirm(`是否删除此工艺路线的所有数据?`, '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            let inData = {
              site: row.site,
              partNo: row.partNo,
              revNo: row.revNo,
            }
            deleteRoutingHeaderData(inData).then(({data}) => {
              if (data && data.code == 200) {
                this.searchRoutingWithPartNo();
              } else {
                this.$alert(data.msg, '错误', {
                  confirmButtonText: '确定'
                })
              }
            })
          })
        },
        getBaseData(val){
          if (this.tagNo === 24){
            this.detailData.workCenterNo = val.WorkCenterNo
          }
          if (this.tagNo === 70){
            this.toolData.toolID = val.ToolID
            this.getToolDesc();
          }
          if (this.tagNo === 5){
            if(this.tagNo2===1) {
              this.copyRoutingData.partNo1 = val.PartNo
              this.getPartDescription();
            }else {
              this.routingHeaderData.partNo= val.PartNo
            }
          }
        },
        // 获取基础数据列表
        getBaseList(val,val2){
          this.tagNo = val
          this.tagNo2 = val2
          this.$nextTick(() => {
            let strVal = "";
            if (val === 24){
              strVal = this.detailData.workCenterNo
            }
            if (val === 70){
                strVal = this.toolData.toolID

            }
            if (val === 5){
              if(val2===1) {
                strVal = this.copyRoutingData.partNo1
              }else {
                strVal = this.routingHeaderData.partNo
              }
            }
            this.$refs.baseList.init(val,strVal)
          })
        },
        addRoutingDetail(){
          if(this.mainData.partNo==null||this.mainData.partNo==''){
            this.$alert("请选择物料号！", '错误', {
              confirmButtonText: '确定'
            })
              return false;
          }
          let size;
          let itemNo;
          if(this.dataList2){
            size=this.dataList2.length;
            itemNo=this.dataList2[Number(size-1)].itemNo+10;
          }else {
            itemNo=10;
          }
          this.detailData={
            itemNo:itemNo,
            operationDesc:'',
            workCenterNo:'',
            machSetupTime:0,
            machRunFactor:0,
            factorUnit:null,
            jjgzUnitPrice:0,
            jjgzUnitFactor:'',
            efficiency:0,
            crewsize:0,
            remark:'',
            add:0,
            partNo:this.mainData.partNo,
            revNo:this.mainData.revNo,
            site:this.mainData.site,
            user:this.$store.state.user.name,
          }
          this.detailmodelInputFlag=false;
          this.detailmodelFlag=true;

        },
        saveRoutingDetailData(){
          if(this.detailData.itemNo==''||this.detailData.itemNo==null){
            this.$alert("请输入工序号！",'错误',{
              confirmButtonText:'确定'
            })
            return false;
          }
          if(this.detailData.operationDesc==''||this.detailData.operationDesc==null){
            this.$alert("请输入工序名称！",'错误',{
              confirmButtonText:'确定'
            })
            return false;
          }
           if(this.detailData.machSetupTime===''||this.detailData.machSetupTime==null){
             this.$alert("请输入准备时间！",'错误',{
               confirmButtonText:'确定'
             })
             return false;
           }
          if(this.detailData.workCenterNo==''||this.detailData.workCenterNo==null){
            this.$alert("请输入加工中心编码！",'错误',{
              confirmButtonText:'确定'
            })
            return false;
          }
           if(this.detailData.jjgzUnitPrice===''||this.detailData.jjgzUnitPrice==null){
             this.$alert("请输入计价单价！",'错误',{
               confirmButtonText:'确定'
             })
             return false;
           }
           if(this.detailData.crewsize===''||this.detailData.crewsize==null){
             this.$alert("请输入操作员人数！",'错误',{
               confirmButtonText:'确定'
             })
             return false;
           }
           if(this.detailData.efficiency===''||this.detailData.efficiency==null){
             this.$alert("请输入效率！",'错误',{
               confirmButtonText:'确定'
             })
             return false;
           }
          saveRoutingDetailData(this.detailData).then(({data}) => {
            this.currentRow=null;
            if (data && data.code == 200) {
              this.detailmodelFlag = false
              let data1={
                site: this.mainData.site,
                partNo:this.mainData.partNo,
                revNo:this.mainData.revNo,
              }
              searchRoutingDetailData(data1).then(({data}) => {
                this.dataList2=data.rows;
              })
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {
                }
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        },
        deleteRoutingDetail(){
          if(this.currentRow==null){
            this.$alert("请选择工艺路线工序！", '错误', {
              confirmButtonText: '确定'
            })
            return false;
          }
          this.$confirm(`是否删除此工艺路线工序?`, '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'

          }).then(() => {
            deleteRoutingDetail(this.currentRow).then(({data}) => {
              this.currentRow=null;
              if (data && data.code == 200) {
                let data1={
                  site: this.mainData.site,
                  partNo:this.mainData.partNo,
                  revNo:this.mainData.revNo,
                }
                searchRoutingDetailData(data1).then(({data}) => {
                  this.dataList2=data.rows;
                })
                this.$message({
                  message: '删除成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {
                  }
                })
              } else {
                this.$alert(data.msg, '错误', {
                  confirmButtonText: '确定'
                })
              }
            })
          })
        },
        tableHanddle(row) {
          let data={
            partNo:row.partNo,
            site:row.site,
            revNo:row.revNo,
          }
          searchRoutingWithPartNo(data).then(({data}) => {
            if(data.rows.length>0){
              if(data.rows[0].repairFlag=='Y'){
                data.rows[0].repairFlag=true;
              }else {
                data.rows[0].repairFlag=false;
              }
              if(data.rows[0].defaultflag=='Y'){
                data.rows[0].defaultflag=true;
              }else {
                data.rows[0].defaultflag=false;
              }
              this.mainData = data.rows[0]
              let data1={
                site: data.rows[0].site,
                partNo:data.rows[0].partNo,
                revNo:data.rows[0].revNo,
              }
              searchRoutingDetailData(data1).then(({data}) => {
                this.dataList2=data.rows;
              })
              searchRoutingToolData(data1).then(({data}) => {
                this.dataList3=data.rows;
              })
            }

          })
          this.modelFlag = false;

        },
        getResourceModel(){
          if(this.currentRow==null){
            this.$alert("请选择工艺路线工序！", '错误', {
              confirmButtonText: '确定'
            })
            return false;
          }
          let data1={
            site:this.mainData.site,
            workCenterNo:this.currentRow.workCenterNo,
          }
          searchAllResource(data1).then(({data}) => {
            this.resourceList1 = data.rows
          })
          let data2={
            site:this.mainData.site,
            partNo:this.mainData.partNo,
            revNo:this.currentRow.revNo,
            itemNo:this.currentRow.itemNo
          }
          searchUsedResource(data2).then(({data}) => {
            this.resourceList2 = data.rows
          })
          this.routingModelFlag=true;
        },
        getSearchModal() {
          this.searchPartNo = '';
          this.searchRoutingWithPartNo();
          this.modelFlag = true;
        },
        editRoutingDetail(){
          if(this.currentRow==null){
            this.$alert("请选择工艺路线工序！", '错误', {
              confirmButtonText: '确定'
            })
            return false;
          }
          this. detailData={
            itemNo:this.currentRow.itemNo,
            operationDesc:this.currentRow.operationDesc,
            workCenterNo:this.currentRow.workCenterNo,
            machSetupTime:this.currentRow.machSetupTime,
            machRunFactor:this.currentRow.machRunFactor,
            factorUnit:this.currentRow.factorUnit,
            jjgzUnitPrice:this.currentRow.jjgzUnitPrice,
            jjgzUnitFactor:this.currentRow.jjgzUnitFactor,
            efficiency:this.currentRow.efficiency,
            crewsize:this.currentRow.crewsize,
            remark:this.currentRow.remark,
            add:1,
            partNo:this.mainData.partNo,
            revNo:this.mainData.revNo,
            site:this.mainData.site,
            user:this.$store.state.user.name,
          }
          this.detailmodelInputFlag=true;
          this.detailmodelFlag=true;
        },
        searchRoutingWithPartNo() {
          let data={
            partNo:this.searchPartNo
          }
          searchRoutingWithPartNo(data).then(({data}) => {
            this.dataList = data.rows
          })
        },
        clickData(row){
          this.currentRow = JSON.parse(JSON.stringify(row));
        },
        clickData2(row){
          this.currentRow2 = JSON.parse(JSON.stringify(row));
        },
        clickData3(row){
          this.currentRow3 = JSON.parse(JSON.stringify(row));
        },
        clickData4(row){
          this.currentRow4 = JSON.parse(JSON.stringify(row));
        },
        addResource(){
          if(this.currentRow3==null){
            this.$alert("请选择可选机台！", '错误', {
              confirmButtonText: '确定'
            })
            return false;
          }
          let inData={
            site: this.mainData.site,
            partNo:this.mainData.partNo,
            revNo:this.mainData.revNo,
            itemNo:this.currentRow.itemNo,
            resourceID:this.currentRow3.resourceID
          }
          addRoutingResource(inData).then(({data}) => {

            if (data && data.code == 200) {
              let data2={
                site:this.mainData.site,
                partNo:this.mainData.partNo,
                revNo:this.currentRow.revNo,
                itemNo:this.currentRow.itemNo
              }
              searchUsedResource(data2).then(({data}) => {
                this.resourceList2 = data.rows
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        },
        addRoutingTool(){
          if(this.mainData.partNo==null||this.mainData.partNo==''){
            this.$alert("请选择物料号！", '错误', {
              confirmButtonText: '确定'
            })
            return false;
          }
          this.toolData={
                site:this.mainData.site,
                partNo:this.mainData.partNo,
                revNo:this.mainData.revNo,
                itemNo:'',
                operationDesc:'',
                toolID:'',
                toolDescription:'',
                spec:'',
                toolQty:'',
                remark:'',
                user:this.$store.state.user.name,
                add:0,
            };
          this.selectList=[];
          let data={
            site:this.mainData.site,
            partNo:this.mainData.partNo,
            revNo:this.mainData.revNo,
          }
          getItemSelect(data).then(({data}) => {
            let list=data.rows;
            for (let i = 0; i <list.length ; i++) {
              let resultData = {
                value:list[i].itemNo,
                label:list[i].itemNo
              }
              this.selectList.push(resultData);
            }
          })
          this.toolmodelInputFlag=false;
          this.ToolmodelFlag=true;
        },
        editRoutingTool(){
          if(this.currentRow2==null){
            this.$alert("请选择工具！", '错误', {
              confirmButtonText: '确定'
            })
            return false;
          }
          this.toolData={
            site:this.mainData.site,
            partNo:this.mainData.partNo,
            revNo:this.mainData.revNo,
            itemNo:this.currentRow2.itemNo,
            operationDesc:this.currentRow2.operationDesc,
            toolID:this.currentRow2.toolID,
            toolDescription:this.currentRow2.toolDescription,
            spec:this.currentRow2.spec,
            toolQty:this.currentRow2.toolQty,
            remark:this.currentRow2.remark,
            user:this.$store.state.user.name,
            add:1,
          };
          this.getOperationDesc();
          this.toolmodelInputFlag=true;
          this.ToolmodelFlag=true;
        },
        saveRoutingTool(){
          if(this.toolData.itemNo==''||this.toolData.itemNo==null){
            this.$alert("请选择工序号！",'错误',{
              confirmButtonText:'确定'
            })
            return false;
          }
          if(this.toolData.toolID==''||this.toolData.toolID==null){
            this.$alert("请输入工具编号！",'错误',{
              confirmButtonText:'确定'
            })
            return false;
          }
          if(this.toolData.toolQty==''||this.toolData.toolQty==null){
            this.$alert("请输入工具数量！",'错误',{
              confirmButtonText:'确定'
            })
            return false;
          }
          saveRoutingTool(this.toolData).then(({data}) => {
            this.currentRow2=null;
            if (data && data.code == 200) {
              this.ToolmodelFlag = false
              let data1={
                site: this.mainData.site,
                partNo:this.mainData.partNo,
                revNo:this.mainData.revNo,
              }
              searchRoutingToolData(data1).then(({data}) => {
                this.dataList3=data.rows;
              })
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {
                }
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        },
        deleteRoutingTool(){
          if(this.currentRow2==null){
            this.$alert("请选择工具！", '错误', {
              confirmButtonText: '确定'
            })
            return false;
          }
          this.$confirm(`是否删除此工具信息?`, '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            let delDate={
              site:this.mainData.site,
              partNo:this.mainData.partNo,
              revNo:this.mainData.revNo,
              itemNo:this.currentRow2.itemNo,
              toolID:this.currentRow2.toolID,
            }
            deleteRoutingTool(delDate).then(({data}) => {
              this.currentRow2=null;
              if (data && data.code == 200) {
                this.ToolmodelFlag = false
                let data1={
                  site: this.mainData.site,
                  partNo:this.mainData.partNo,
                  revNo:this.mainData.revNo,
                }
                searchRoutingToolData(data1).then(({data}) => {
                  this.dataList3=data.rows;
                })
                this.$message({
                  message: '删除成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {
                  }
                })
              } else {
                this.$alert(data.msg, '错误', {
                  confirmButtonText: '确定'
                })
              }
            })
          })
        },
        getOperationDesc(){
          let data={
            site:this.mainData.site,
            partNo:this.mainData.partNo,
            revNo:this.mainData.revNo,
            itemNo:this.toolData.itemNo
          }
          getItemSelect(data).then(({data}) => {
            if(data.rows.length>0){
              this.toolData.operationDesc=data.rows[0].operationDesc
            }
          })
        },
        getToolDesc(){
          let data={
            site:this.mainData.site,
            toolID:this.toolData.toolID
          }
          getToolDesc(data).then(({data}) => {
            if(data.rows.length>0){
              this.toolData.toolDescription=data.rows[0].toolDescription
              this.toolData.spec=data.rows[0].spec
            }
          })
        },
        deleteResource(){
          if(this.currentRow4==null){
            this.$alert("请选择已选机台！", '错误', {
              confirmButtonText: '确定'
            })
            return false;
          }
          this.$confirm(`是否删除此机台?`, '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'

          }).then(() => {
            let inData = {
              site: this.mainData.site,
              partNo: this.mainData.partNo,
              revNo: this.mainData.revNo,
              itemNo: this.currentRow.itemNo,
              resourceID: this.currentRow4.resourceID
            }
            deleteRoutingResource(inData).then(({data}) => {
              if (data && data.code == 200) {
                this.currentRow4 = null;
                let data2 = {
                  site: this.mainData.site,
                  partNo: this.mainData.partNo,
                  revNo: this.currentRow.revNo,
                  itemNo: this.currentRow.itemNo
                }
                searchUsedResource(data2).then(({data}) => {
                  this.resourceList2 = data.rows
                })
              } else {
                this.$alert(data.msg, '错误', {
                  confirmButtonText: '确定'
                })
              }
            })
          })
        },
        jumpWorkCenter(){
          if(this.currentRow==null){
            this.$alert("请选择工艺路线工序！", '错误', {
              confirmButtonText: '确定'
            })
            return false;
          }
          let inData={user:this.$store.state.user.name,site:this.currentRow.site,workCenterNo:this.currentRow.workCenterNo};
          localStorage.setItem('workCenterNo', JSON.stringify(inData))
          this.$router.replace('base-workCenter')
        },
        jumpToolInfo(){
          if(this.currentRow2==null){
            this.$alert("请选择工具！", '错误', {
              confirmButtonText: '确定'
            })
            return false;
          }
          let inData={site:this.$store.state.user.site,toolId:this.currentRow2.toolID,toolDescription:this.currentRow2.toolDescription};
          localStorage.setItem('toolInfo', JSON.stringify(inData))
          this.$router.replace('knifemold-tool-info')
        },
        getPartDetail(){
          if(this.mainData.partNo==null||this.mainData.partNo==''){
            this.$alert("请选择物料编码！", '错误', {
              confirmButtonText: '确定'
            })
            return false;
          }
          let inData={
            user:this.$store.state.user.name,
            site:this.mainData.site,
            partNo:this.mainData.partNo
          }
          searchPartNoData(inData).then(({data}) => {
            if (data.rows.length==0){
              this.$alert("该物料编码不存在", '错误', {
                confirmButtonText: '确定'
              })
              return false;
            }
            this.partData = data.rows[0];
            this.partFlag=true;
          })
        },
        changeStatus(){
          if(this.mainData.partNo==null||this.mainData.partNo==''){
            this.$alert("请选择物料编码！", '错误', {
              confirmButtonText: '确定'
            })
            return false;
          }
          this.status=this.mainData.status;
          this.statusFlag=true;
        },
        saveStatus(){
          if(this.status==this.mainData.status){
            this.$alert("该物料状态为"+this.status+",不需要修改！", '错误', {
              confirmButtonText: '确定'
            })
            return false;
          }
          let inData={
            partNo:this.mainData.partNo,
            site:this.mainData.site,
            revNo:this.mainData.revNo,
            status:this.status
          }
          changeRoutingStatus(inData).then(({data}) => {
            if (data && data.code == 200) {
              this.statusFlag = false
              searchRoutingWithPartNo(inData).then(({data}) => {
                if(data.rows.length>0){
                  if(data.rows[0].repairFlag=='Y'){
                    data.rows[0].repairFlag=true;
                  }else {
                    data.rows[0].repairFlag=false;
                  }
                  if(data.rows[0].defaultflag=='Y'){
                    data.rows[0].defaultflag=true;
                  }else {
                    data.rows[0].defaultflag=false;
                  }
                  this.mainData = data.rows[0]
                  let data1={
                    site: data.rows[0].site,
                    partNo:data.rows[0].partNo,
                    revNo:data.rows[0].revNo,
                  }
                  searchRoutingDetailData(data1).then(({data}) => {
                    this.dataList2=data.rows;
                  })
                  searchRoutingToolData(data1).then(({data}) => {
                    this.dataList3=data.rows;
                  })
                }

              })
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {
                }
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        },
        tongBuOrder(){
          if(this.mainData.partNo==null||this.mainData.partNo==''){
            this.$alert("请选择物料编码！", '错误', {
              confirmButtonText: '确定'
            })
            return false;
          }
          this.$confirm(`确定要把该工艺路线同步到该产品的未开工生产订单上吗？`, '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'
          }).then(() => {
            let inData={
              partNo:this.mainData.partNo,
              site:this.mainData.site,
              revNo:this.mainData.revNo,
              user:this.$store.state.user.name,
            }
            checkRoutingAndOrder(inData).then(({data}) => {
              if (data && data.code == 200) {
                this.$confirm('有'+data.obj+'个生产订单将会被同步，是否继续？', '提示', {
                  confirmButtonText: '确定',
                  cancelButtonText: '取消',
                  type: 'warning'
                }).then(() => {
                  changeOrderRouting(inData).then(({data}) =>{
                    if (data && data.code == 200) {
                      this.$message({
                        message: '操作成功',
                        type: 'success',
                        duration: 1500,
                        onClose: () => {
                        }
                      })
                    } else {
                      this.$alert(data.msg, '错误', {
                        confirmButtonText: '确定'
                      })
                    }
                  })
                })
              } else {
                this.$alert(data.msg, '错误', {
                  confirmButtonText: '确定'
                })
              }
            })
          })
        },
        copyRouting(){
          if(this.mainData.partNo==null||this.mainData.partNo==''){
            this.$alert("请选择物料编码！", '错误', {
              confirmButtonText: '确定'
            })
            return false;
          }
          this.copyRoutingData={
            partNo:this.mainData.partNo,
            partDescription:this.mainData.spec,
            revNo:this.mainData.revNo,
            phaseInDate:this.mainData.phaseInDate,
            repairFlag:this.mainData.repairFlag,
            partNo1:'',
            partDescription1:'',
            revNo1:'',
            phaseInDate1:new Date(),
            repairFlag1:false,
            oldFlag:false,
            toolFlag:false,
            resourceFlag:false,
          },
          this.copyRoutingModelFlag=true;
        },
        saveCopyRouting(){
          if(this.copyRoutingData.partNo1==''||this.copyRoutingData.partNo1==null){
            this.$alert("请输入新物料号！",'错误',{
              confirmButtonText:'确定'
            })
            return false;
          }
          if(this.copyRoutingData.revNo1==''||this.copyRoutingData.revNo1==null){
            this.$alert("请输入新版本号！",'错误',{
              confirmButtonText:'确定'
            })
            return false;
          }
          if(this.copyRoutingData.phaseInDate1==''||this.copyRoutingData.phaseInDate1==null){
            this.$alert("请选择新启用日期！",'错误',{
              confirmButtonText:'确定'
            })
            return false;
          }
          let repairFlag1='N';
          if(this.copyRoutingData.repairFlag1===true){
            repairFlag1='Y';
          }
          let inData={
            site:this.mainData.site,
            partNo:this.copyRoutingData.partNo,
            revNo:this.copyRoutingData.revNo,
            partNo1:this.copyRoutingData.partNo1,
            revNo1:this.copyRoutingData.revNo1,
            phaseInDate1:this.copyRoutingData.phaseInDate1,
            repairFlag1:repairFlag1,
            oldFlag:this.copyRoutingData.oldFlag,
            toolFlag:this.copyRoutingData.toolFlag,
            resourceFlag:this.copyRoutingData.resourceFlag,
            user:this.$store.state.user.name
          }
          saveCopyRouting(inData).then(({data}) => {
            if (data && data.code == 200) {
              this.copyRoutingModelFlag = false
              this.$message({
                message: '操作成功',
                type: 'success',
                duration: 1500,
                onClose: () => {
                }
              })
            } else {
              this.$alert(data.msg, '错误', {
                confirmButtonText: '确定'
              })
            }
          })
        },
        getPartDescription(){
          let inData={
            user:this.$store.state.user.name,
            site:this.mainData.site,
            partNo:this.copyRoutingData.partNo1
          }
          searchPartNoData(inData).then(({data}) => {
            if (data.rows.length==0){
              return false;
            }
            this.copyRoutingData.partDescription1 = data.rows[0].partDescription;
          })

        },
        setDefault(){
          if(this.mainData.partNo==null||this.mainData.partNo==''){
            this.$alert("请选择物料编码！", '错误', {
              confirmButtonText: '确定'
            })
            return false;
          }
          this.$confirm(`是否将此工艺路线版本设为默认?`, '提示', {
            confirmButtonText: '确定',
            cancelButtonText: '取消',
            type: 'warning'

          }).then(() => {
            let data1 = {
              site: this.mainData.site,
              partNo: this.mainData.partNo,
              revNo: this.mainData.revNo,
            }
            setDefault(data1).then(({data}) => {
              if (data && data.code == 200) {
                this.mainData.defaultflag=true;
                this.$message({
                  message: '操作成功',
                  type: 'success',
                  duration: 1500,
                  onClose: () => {
                  }
                })
              } else {
                this.$alert(data.msg, '错误', {
                  confirmButtonText: '确定'
                })
              }
            })
          })
        },
      },
      created() {

      }
    }
</script>

<style scoped>

</style>
