<template>
  <div class="app-container">
    <el-card style="height: 850px">
      <div style="margin-top: 10px">
        <el-table
          v-loading="loading"
          ref="table"
          :data="tableData"
          :reserve-selection="true"
          :row-key="row => row.订单流水号"
          border
          height="300"
          highlight-current-row
          size="mini"
          stripe
          style="width: 1856px;margin-top: 10px"
          @row-click="searchTable1">
          <el-table-column :width="setColumnWidth('状态')" align="center" label="状态">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.是否审核 === 0" size="small" style="margin: 0px" type="warning">未审批</el-tag>
              <el-tag v-if="scope.row.是否审核 === 1" size="small" style="margin: 0px" type="success">已审批</el-tag>
            </template>
          </el-table-column>
          <el-table-column align="center" label="订单编号" show-overflow-tooltip width="131px">
            <template slot-scope="scope">
              {{ scope.row.订单编号 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="收货人" show-overflow-tooltip width="67px">
            <template slot-scope="scope">
              {{ scope.row.收货人 }}
            </template>
          </el-table-column>
          <el-table-column :width="setColumnWidth('日期')" align="center" label="完成工期" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.完成期限 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="下单人" show-overflow-tooltip width="67px">
            <template slot-scope="scope">
              {{ scope.row.创建人 }}
            </template>
          </el-table-column>
          <el-table-column :width="setColumnWidth('日期')" align="center" label="下单日期" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.合同日期 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="合同交期" width="90px">
            <template slot-scope="scope">
              {{ scope.row.交货期限 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="订单备注" show-overflow-tooltip width="100px">
            <template slot-scope="scope">
              {{ scope.row.订单备注 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="审核通过" show-overflow-tooltip width="90px">
            <template slot-scope="scope">
              {{ scope.row.确认日期 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="技术审核" show-overflow-tooltip width="110px">
            <template slot-scope="scope">
              <el-checkbox
                v-model="scope.row.技术审核"
                :disabled="scope.row.确认日期!==null"
                label="技术审核"
                @change="changeA(scope.row)"/>
            </template>
          </el-table-column>
          <el-table-column align="center" label="下达部门" show-overflow-tooltip width="550px">
            <template slot-scope="scope">
              <el-checkbox
                v-model="scope.row.仓库"
                :disabled="scope.row.技术审核 || Number(scope.row.订单类型)===3 || scope.row.动力头 || scope.row.滑台 || scope.row.专机 || scope.row.精工车间 || scope.row.采购 || scope.row.专机"
                label="发货"
                @click.native.stop/>
              <el-checkbox
                v-model="scope.row.精工车间"
                :disabled="scope.row.技术审核 || (Number(scope.row.订单类型)===3 && scope.row.订单编号.split('-')[0] ==='BHWG') || Number(scope.row.订单类型)===2 || Number(scope.row.订单类型)===7 || scope.row.仓库 || scope.row.动力头 || scope.row.滑台 || scope.row.采购 || scope.row.专机"
                label="精工车间"
                @click.native.stop/>
              <el-checkbox
                v-model="scope.row.动力头"
                :disabled="scope.row.技术审核 || (Number(scope.row.订单类型)!==1 && Number(scope.row.订单类型)!==5 && Number(scope.row.订单类型)!==6) || scope.row.仓库 || scope.row.滑台 || scope.row.精工车间 || scope.row.采购 || scope.row.专机"
                label="动力头"
                @click.native.stop/>
              <el-checkbox
                v-model="scope.row.滑台"
                :disabled="scope.row.技术审核 || (Number(scope.row.订单类型)!==1 && Number(scope.row.订单类型)!==5 && Number(scope.row.订单类型)!==6) || scope.row.动力头 || scope.row.仓库 || scope.row.精工车间 || scope.row.采购 || scope.row.专机"
                label="滑台"
                @click.native.stop/>
              <el-checkbox
                v-model="scope.row.采购"
                :disabled="scope.row.技术审核 || (Number(scope.row.订单类型)===3 && scope.row.订单编号.split('-')[0] ==='BHZZ') || Number(scope.row.订单类型)===2 || Number(scope.row.订单类型)===7 || scope.row.仓库 || scope.row.动力头 || scope.row.滑台 || scope.row.精工车间 || scope.row.专机"
                label="采购"
                @click.native.stop/>
              <el-checkbox
                v-model="scope.row.专机"
                :disabled="scope.row.技术审核 || Number(scope.row.订单类型)===3 || scope.row.仓库 || scope.row.动力头 || scope.row.滑台 || scope.row.精工车间 || scope.row.采购"
                label="专机"
                @click.native.stop/>
            </template>
          </el-table-column>
          <el-table-column align="center" label="操作">
            <template slot-scope="scope">
              <el-tooltip :open-delay="500" content="编辑各节点期限" effect="dark" placement="top">
                <el-button icon="el-icon-date" size="mini" type="text" @click="toogleExpand(scope.row)"/>
              </el-tooltip>
              <el-tooltip :open-delay="500" content="查看客户提供资料" effect="dark" placement="top">
                <el-button icon="el-icon-picture-outline" size="mini" type="text" @click="ContractPhoto(scope.row)"/>
              </el-tooltip>
              <el-tooltip :open-delay="500" content="查看装配打回原因" effect="dark" placement="top">
                <el-button
                  :disabled="Number(scope.row.是否有打回)===0"
                  icon="el-icon-search"
                  size="mini"
                  type="text"
                  @click="searchReason(scope.row)"/>
              </el-tooltip>
              <el-button
                :disabled="scope.row.技术审核 || scope.row.是否审核 === 0"
                plain
                size="mini"
                type="primary"
                @click.native.stop="editProduct(scope.row)">订单投产
              </el-button>
            </template>
          </el-table-column>
          <el-table-column type="expand" width="1">
            <template slot-scope="scope">
              <div style="float: right;margin: 5px 0px 5px 0;background-color: #d8e5f6">
                <span style="font-size: 14px">技术确认:</span>
                <!--                <span style="background-color: #9bd7fc;font-size: 14px">技术确认:</span>-->
                <el-date-picker
                  v-model="scope.row.技术确认日期"
                  align="center"
                  format="yyyy-MM-dd"
                  placeholder="选择日期"
                  size="small"
                  style="width: 140px;margin-right: 20px"
                  value-format="yyyy-MM-dd"
                  @click.native.stop/>
                <span style="font-size: 14px;">采购/外协:</span>
                <el-date-picker
                  v-model="scope.row.采购日期"
                  align="center"
                  format="yyyy-MM-dd"
                  placeholder="选择日期"
                  size="small"
                  style="width: 140px;margin-right: 20px"
                  value-format="yyyy-MM-dd"
                  @click.native.stop/>
                <span style="font-size: 14px;">通用装配:</span>
                <el-date-picker
                  v-model="scope.row.通用装配日期"
                  align="center"
                  format="yyyy-MM-dd"
                  placeholder="选择日期"
                  size="small"
                  style="width: 140px;margin-right: 20px"
                  value-format="yyyy-MM-dd"
                  @click.native.stop/>
                <span style="font-size: 14px;">精工车间:</span>
                <el-date-picker
                  v-model="scope.row.精工车间日期"
                  align="center"
                  format="yyyy-MM-dd"
                  placeholder="选择日期"
                  size="small"
                  style="width: 140px;margin-right: 20px"
                  value-format="yyyy-MM-dd"
                  @click.native.stop/>
                <span style="font-size: 14px;">专机装配:</span>
                <el-date-picker
                  v-model="scope.row.专机装配日期"
                  align="center"
                  format="yyyy-MM-dd"
                  placeholder="选择日期"
                  size="small"
                  style="width: 140px;margin-right: 20px"
                  value-format="yyyy-MM-dd"
                  @click.native.stop/>
              </div>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <div v-show="Number(typeValue)!==3" style="margin-top: 10px">
        <el-table
          ref="table1"
          :data="tableData1"
          :header-cell-style="changeStyle"
          border
          height="500px"
          highlight-current-row
          size="mini"
          stripe
          style="width: 1856px;margin-top: 10px"
          @selection-change="handleSelectionChange">
          <el-table-column :selectable="selectable" align="center" type="selection" width="50px"/>
          <el-table-column align="center" fixed label="部件状态" show-overflow-tooltip width="75px">
            <template slot-scope="scope">
              {{ scope.row.任务状态 }}
            </template>
          </el-table-column>
          <el-table-column :width="setColumnWidth('产品名称')" align="center" fixed label="部件名称">
            <template slot-scope="scope">
              {{ scope.row.产品名称 }}
            </template>
          </el-table-column>
          <el-table-column align="center" fixed label="类型" width="80px">
            <template slot-scope="scope">
              {{ scope.row.类型 }}
            </template>
          </el-table-column>
          <el-table-column :width="setColumnWidth('单位')" align="center" fixed label="单位">
            <template slot-scope="scope">
              {{ scope.row.单位 }}
            </template>
          </el-table-column>
          <el-table-column :width="setColumnWidth('数量')" align="center" fixed label="数量">
            <template slot-scope="scope">
              {{ scope.row.数量 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="产品详情" width="230px">
            <template slot-scope="scope">
              {{ scope.row.产品详情 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="轴承型号" width="110px">
            <template slot-scope="scope">
              {{ scope.row.轴承位置文本 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="安装方向" width="90px">
            <template slot-scope="scope">
              {{ scope.row.安装方向名称 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="电机型号/电机联接板" width="160px">
            <template slot-scope="scope">
              {{ scope.row.电机位置文本 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="传动方式" width="90px">
            <template slot-scope="scope">
              {{ scope.row.传动方式位置文本 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="主轴轮" width="90px">
            <template slot-scope="scope">
              {{ scope.row.主轴轮名称 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="电机轮" width="90px">
            <template slot-scope="scope">
              {{ scope.row.电机轮名称 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="传动带" width="90px">
            <template slot-scope="scope">
              {{ scope.row.皮带轮名称 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="拉杆" width="90px">
            <template slot-scope="scope">
              {{ scope.row.拉杆名称 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="其它" width="90px">
            <template slot-scope="scope">
              {{ scope.row.其它 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="输出转速" width="80px">
            <template slot-scope="scope">
              {{ scope.row.输出转速 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="中心内冷" width="90px">
            <template slot-scope="scope">
              {{ scope.row.中心内冷名称 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="防护类型" width="90px">
            <template slot-scope="scope">
              {{ scope.row.防护类型名称 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="电机型号" width="90px">
            <template slot-scope="scope">
              {{ scope.row.滑台电机文本 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="电机联接板" width="90px">
            <template slot-scope="scope">
              {{ scope.row.电机联接板文本 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="联轴器" width="90px">
            <template slot-scope="scope">
              {{ scope.row.联轴器文本 }}
            </template>
          </el-table-column>
          <el-table-column align="center" fixed="right" label="操作" width="150px">
            <template slot-scope="scope">
              <el-tooltip :open-delay="300" content="自制件BOM" effect="dark" placement="top">
                <el-button
                  :disabled="scope.row.是否滑台 === 1 || scope.row.是否滑台 === 2"
                  icon="el-icon-document"
                  size="mini"
                  type="text"
                  @click="BOM(scope.row)"/>
              </el-tooltip>
              <el-tooltip :open-delay="500" content="修改参数" effect="dark" placement="top">
                <el-button
                  :disabled="(Number(token) !== 2 && Number(token) !== 3 && Number(token) !== 11 && Number(token) !== 22)"
                  icon="el-icon-edit"
                  size="mini"
                  type="text"
                  @click="editTable(scope.row)"/>
              </el-tooltip>
            </template>
          </el-table-column>
        </el-table>
      </div>
      <!--<div v-show="Number(typeValue)===2" style="margin-top: 10px">
        <el-table ref="table2" :data="tableData1" :header-cell-style="changeStyle" highlight-current-row border stripe size="mini" style="width: 1856px;margin-top: 10px" height="500px" @selection-change="handleSelectionChange">
          <el-table-column width="75px" label="部件状态" fixed align="center" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.任务状态 }}
            </template>
          </el-table-column>
          <el-table-column :width="setColumnWidth('产品名称')" label="部件名称" fixed align="center" show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.产品名称 }}
            </template>
          </el-table-column>
          <el-table-column :width="setColumnWidth('单位')" label="单位" fixed align="center">
            <template slot-scope="scope">
              {{ scope.row.单位 }}
            </template>
          </el-table-column>
          <el-table-column :width="setColumnWidth('数量')" label="数量" fixed align="center">
            <template slot-scope="scope">
              {{ scope.row.数量 }}
            </template>
          </el-table-column>
          <el-table-column width="230px" label="产品详情" align="center" fixed show-overflow-tooltip>
            <template slot-scope="scope">
              {{ scope.row.产品详情 }}
            </template>
          </el-table-column>
          <el-table-column width="110px" label="轴承型号" align="center">
            <template slot-scope="scope">
              {{ scope.row.轴承位置文本 }}
            </template>
          </el-table-column>
          <el-table-column width="90px" label="安装方向" align="center">
            <template slot-scope="scope">
              {{ scope.row.安装方向名称 }}
            </template>
          </el-table-column>
          <el-table-column width="160px" label="电机型号/电机联接板" align="center">
            <template slot-scope="scope">
              {{ scope.row.电机位置文本 }}
            </template>
          </el-table-column>
          <el-table-column width="90px" label="传动方式" align="center">
            <template slot-scope="scope">
              {{ scope.row.传动方式位置文本 }}
            </template>
          </el-table-column>
          <el-table-column width="90px" label="主轴轮" align="center">
            <template slot-scope="scope">
              {{ scope.row.主轴轮名称 }}
            </template>
          </el-table-column>
          <el-table-column width="90px" label="电机轮" align="center">
            <template slot-scope="scope">
              {{ scope.row.电机轮名称 }}
            </template>
          </el-table-column>
          <el-table-column width="90px" label="传动带" align="center">
            <template slot-scope="scope">
              {{ scope.row.皮带轮名称 }}
            </template>
          </el-table-column>
          <el-table-column width="90px" label="其它" align="center">
            <template slot-scope="scope">
              {{ scope.row.其它 }}
            </template>
          </el-table-column>
          <el-table-column width="80px" label="输出转速" align="center">
            <template slot-scope="scope">
              {{ scope.row.输出转速 }}
            </template>
          </el-table-column>
          <el-table-column width="90px" label="中心内冷" align="center">
            <template slot-scope="scope">
              {{ scope.row.中心内冷名称 }}
            </template>
          </el-table-column>
          <el-table-column width="90px" label="防护类型" align="center">
            <template slot-scope="scope">
              {{ scope.row.防护类型名称 }}
            </template>
          </el-table-column>
          <el-table-column width="90px" label="电机联接板" align="center">
            <template slot-scope="scope">
              {{ scope.row.电机联接板 }}
            </template>
          </el-table-column>
          <el-table-column width="90px" label="联轴器" align="center">
            <template slot-scope="scope">
              {{ scope.row.联轴器 }}
            </template>
          </el-table-column>
        </el-table>
      </div>-->
      <div v-show="Number(typeValue)===3" style="margin-top: 10px">
        <el-table
          ref="table3"
          :data="tableData2"
          :header-cell-style="{background: '#2283D4',color: 'white'}"
          border
          height="500px"
          highlight-current-row
          size="mini"
          stripe
          style="width: 671px;margin-top: 10px">
          <el-table-column align="center" label="序号" type="index" width="50px"/>
          <el-table-column align="center" label="物料名称" show-overflow-tooltip width="250px">
            <template slot-scope="scope">
              {{ scope.row.物料名称 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="图号或型号" width="220px">
            <template slot-scope="scope">
              {{ scope.row.图号或型号 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="单位" width="60px">
            <template slot-scope="scope">
              {{ scope.row.单位 }}
            </template>
          </el-table-column>
          <el-table-column align="center" label="补货数量" width="90px">
            <template slot-scope="scope">
              {{ scope.row.补货数 }}
            </template>
          </el-table-column>
        </el-table>
      </div>
    </el-card>
    <el-dialog
      v-el-drag-dialog
      :center="dialogName"
      :visible.sync="dialogVisibleCustomerInformation"
      title="客户提供资料"
      width="20%">
      <div v-for="(file, key) in hadFile" :key="key">
        <div class="wrapper">
          <div class="content">
            <div v-if="file.suffix==='pdf'" class="icon">
              <svg-icon icon-class="pdf"/>
            </div>
            <div v-else-if="file.suffix==='docx'||file.suffix === 'doc'" class="icon">
              <svg-icon icon-class="doc"/>
            </div>
            <div v-else-if="file.suffix==='xlsx' || file.suffix === 'xls'" class="icon">
              <svg-icon icon-class="excel"/>
            </div>
            <div v-else-if="file.suffix==='pptx' || file.suffix === 'ppt'" class="icon">
              <svg-icon icon-class="ppt"/>
            </div>
            <div v-else-if="file.suffix==='jpg' || file.suffix === 'jpeg'|| file.suffix === 'png'" class="icon">
              <svg-icon icon-class="pic"/>
            </div>
            <div v-else class="icon">
              <svg-icon icon-class="file"/>
            </div>
            <a id="appUrl" :href="file.url" target="view_window">
              <div class="info">{{ file.name }}</div>
            </a>
          </div>
        </div>
      </div>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :visible.sync="dialogFormVisible1"
      width="69%">
      <el-button plain size="mini" type="primary" @click="putIntoProductionBOM()">投 产</el-button>
      <el-table
        :data="tableData5"
        :header-cell-style="{background: '#383E4B',color: 'white'}"
        border
        height="580px"
        highlight-current-row
        size="small"
        style="width: 1461px"
        @selection-change="handleSelectionChange1">
        <el-table-column :selectable="selectable1" align="center" type="selection" width="50px"/>
        <el-table-column align="center" label="序号" type="index" width="60px"/>
        <el-table-column align="center" label="图纸" show-overflow-tooltip width="70px">
          <template slot-scope="scope">
            {{ scope.row.图纸 ? '导入' : '未导' }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="零件名称" show-overflow-tooltip width="180px">
          <template slot-scope="scope">
            {{ scope.row.零件名称 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('图号或型号')" align="center" label="图号/型号" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.图号或型号 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="数量" show-overflow-tooltip width="140px">
          <template slot-scope="scope">
            <!--            {{ Number(Number(scope.row.数量) * Number(numberOfParts)) }}-->
            <el-input-number v-model="scope.row.投产数" :min="1" size="mini" style="width: 117px"/>
          </template>
        </el-table-column>
        <el-table-column align="center" label="库存" show-overflow-tooltip width="50px">
          <template slot-scope="scope">
            {{ scope.row.库存 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="需求数" show-overflow-tooltip width="60px">
          <template slot-scope="scope">
            {{ scope.row.需求量 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('材料')" align="center" label="材料" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.材料 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('备注')" align="center" label="零件备注" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.零件备注 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('类型')" align="center" label="类型" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.类型 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('日期')" align="center" label="导入时间">
          <template slot-scope="scope">
            {{ scope.row.导入时间 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('姓名')" align="center" label="导入人">
          <template slot-scope="scope">
            {{ scope.row.导入人 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="操作">
          <template slot-scope="scope">
            <el-tooltip :open-delay="700" content="取消投产" effect="dark" placement="top">
              <el-button
                :disabled="scope.row.是否投产 !== 1"
                size="mini"
                type="text"
                @click="cancelProduction(scope.row)">取消投产
              </el-button>
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :visible.sync="dialogFormVisible"
      center
      width="30%">
      <el-table
        :data="tableData13"
        :header-cell-style="{background: '#383E4B',color: 'white'}"
        border
        highlight-current-row
        size="small"
        stripe
        style="width: 511px">
        <el-table-column align="center" label="序号" type="index" width="60px"/>
        <el-table-column align="center" label="打回原因">
          <template slot-scope="scope">
            {{ scope.row.打回原因 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="打回人员" width="90px">
          <template slot-scope="scope">
            {{ scope.row.姓名 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="打回时间" width="90px">
          <template slot-scope="scope">
            {{ scope.row.打回时间 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="部门" width="90px">
          <template slot-scope="scope">
            {{ scope.row.类型 }}
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :visible.sync="dialogFormVisible10"
      center
      width="83%">
      <el-table
        :data="tableData30"
        :header-cell-style="{background: '#383E4B',color: 'white'}"
        border
        highlight-current-row
        size="small"
        stripe
        style="width: 1551px">
        <el-table-column align="center" fixed label="部件名称" width="200px">
          <template slot-scope="scope">
            {{ scope.row.产品名称 }}
            <!--            <el-cascader ref="cascader" v-model="scope.row.产品位置" :options="product1" :show-all-levels="false" size="small" style="width: 95%" clearable @change="getDataProductLocation()" @dblclick.native.stop/>-->
            <!--            <el-cascader ref="cascader" v-model="scope.row.产品位置" :options="product1" :show-all-levels="false" size="small" style="width: 95%" clearable/>-->
          </template>
        </el-table-column>
        <el-table-column align="center" fixed label="单位" width="100px">
          <template slot-scope="scope">
            <!--            <el-input v-model="scope.row.单位" style="width:95%" placeholder="单位" size="small" clearable/>-->
            {{ scope.row.单位 }}
          </template>
        </el-table-column>
        <el-table-column align="center" fixed label="数量" width="80px">
          <template slot-scope="scope">
            <!--            <el-input v-model="scope.row.数量" style="width:95%" placeholder="数量" size="small" clearable/>-->
            {{ scope.row.数量 }}
          </template>
        </el-table-column>
        <el-table-column align="center" fixed label="产品详情" width="200px">
          <template slot-scope="scope">
            <!--            <el-input v-model="scope.row.产品详情" style="width:95%" placeholder="产品详情" size="small" clearable/>-->
            {{ scope.row.产品详情 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="轴承型号" width="230px">
          <template slot-scope="scope">
            <el-cascader
              ref="cascader"
              v-model="scope.row.轴承位置"
              :options="bearing"
              size="small"
              style="width: 100%"
              @change="getData3(scope.row)"
              @dblclick.native.stop/>
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('安装方向')" align="center" label="安装方向">
          <template slot-scope="scope">
            <el-select v-model="scope.row.安装方向" clearable filterable size="small" style="width: 100%">
              <el-option
                v-for="item in installationDirection"
                :key="item.value"
                :label="item.label"
                :value="item.value"/>
            </el-select>
          </template>
        </el-table-column>
        <el-table-column align="center" label="电机型号" width="300px">
          <template slot-scope="scope">
            <el-cascader
              ref="cascader1"
              v-model="scope.row.电机位置"
              :options="motorModel"
              clearable
              size="small"
              style="width: 100%"
              @change="getData1(scope.row, scope.$index)"/>
          </template>
        </el-table-column>
        <el-table-column align="center" label="传动方式" width="150px">
          <template slot-scope="scope">
            <el-cascader
              ref="cascader"
              v-model="scope.row.传动方式位置"
              :options="transmissionMode"
              :show-all-levels="false"
              clearable
              size="small"
              style="width: 100%"
              @change="getData2(scope.row, scope.$index)"/>
          </template>
        </el-table-column>
        <el-table-column align="center" label="主轴轮" width="190px">
          <template slot-scope="scope">
            <el-select v-model="scope.row.主轴轮" clearable filterable size="small" style="width: 100%">
              <el-option
                v-for="item in spindleWheel"
                :key="item.value"
                :label="item.label"
                :value="item.value"/>
            </el-select>
          </template>
        </el-table-column>
        <el-table-column align="center" label="电机轮" width="190px">
          <template slot-scope="scope">
            <el-select v-model="scope.row.电机轮" clearable filterable size="small" style="width: 100%">
              <el-option
                v-for="item in motorWheel"
                :key="item.value"
                :label="item.label"
                :value="item.value"/>
            </el-select>
          </template>
        </el-table-column>
        <el-table-column align="center" label="传动带" width="180px">
          <template slot-scope="scope">
            <el-select v-model="scope.row.皮带轮" clearable filterable size="small" style="width: 100%">
              <el-option
                v-for="item in pulley"
                :key="item.value"
                :label="item.label"
                :value="item.value"/>
            </el-select>
          </template>
        </el-table-column>
        <el-table-column align="center" label="拉杆" width="180px">
          <template slot-scope="scope">
            <el-select v-model="scope.row.拉杆" clearable filterable size="small" style="width: 100%">
              <el-option
                v-for="item in pullRod"
                :key="item.value"
                :label="item.label"
                :value="item.value"/>
            </el-select>
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('输出转速')" align="center" label="输出转速">
          <template slot-scope="scope">
            <el-input v-model="scope.row.输出转速" size="mini" style="width: 100%"/>
          </template>
        </el-table-column>
        <el-table-column align="center" label="中心内冷" width="160px">
          <template slot-scope="scope">
            <el-select v-model="scope.row.中心内冷" clearable filterable size="small" style="width: 100%">
              <el-option
                v-for="item in CentralInternalCooling"
                :key="item.value"
                :label="item.label"
                :value="item.value"/>
            </el-select>
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" type="distribution" @click="submit()">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :visible.sync="dialogFormVisible2"
      center
      width="60%">
      <el-table
        :data="tableData40"
        :header-cell-style="{background: '#383E4B',color: 'white'}"
        border
        highlight-current-row
        size="small"
        stripe
        style="width: 1091px">
        <el-table-column align="center" label="部件名称" width="130px">
          <template slot-scope="scope">
            {{ scope.row.产品名称 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="单位" width="70px">
          <template slot-scope="scope">
            {{ scope.row.单位 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="数量" width="80px">
          <template slot-scope="scope">
            {{ scope.row.数量 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="产品详情" width="200px">
          <template slot-scope="scope">
            {{ scope.row.产品详情 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="防护类型" width="150px">
          <template slot-scope="scope">
            <el-select v-model="scope.row.防护类型" clearable filterable size="small" style="width: 100%">
              <el-option
                v-for="item in TypeOfProtection"
                :key="item.value"
                :label="item.label"
                :value="item.value"/>
            </el-select>
          </template>
        </el-table-column>
        <el-table-column align="center" label="电机型号" width="150px">
          <template slot-scope="scope">
            <el-cascader
              ref="cascader"
              v-model="scope.row.滑台电机位置"
              :options="motorModel1"
              :show-all-levels="false"
              clearable
              size="small"
              style="width: 100%"
              @change="getData4(scope.row, scope.$index)"/>
          </template>
        </el-table-column>
        <el-table-column align="center" label="电机联接板" width="150px">
          <template slot-scope="scope">
            <el-cascader
              ref="cascader"
              v-model="scope.row.电机联接板"
              :options="ConnectingPlate"
              :show-all-levels="false"
              clearable
              size="small"
              style="width: 100%"
              @change="getData5(scope.row, scope.$index)"/>
          </template>
        </el-table-column>
        <el-table-column align="center" label="联轴器" width="160px">
          <template slot-scope="scope">
            <el-cascader
              ref="cascader"
              v-model="scope.row.联轴器"
              :options="coupling"
              :show-all-levels="false"
              clearable
              size="small"
              style="width: 100%"
              @change="getData6(scope.row, scope.$index)"/>
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" type="distribution" @click="submit1()">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :visible.sync="dialogFormVisible3"
      center
      width="40%">
      <el-table
        :data="tableData50"
        :header-cell-style="{background: '#383E4B',color: 'white'}"
        border
        highlight-current-row
        size="small"
        stripe
        style="width: 99%;">
        <el-table-column align="center" label="部件名称" min-width="130px">
          <template slot-scope="scope">
            {{ scope.row.产品名称 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="单位" min-width="70px">
          <template slot-scope="scope">
            {{ scope.row.单位 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="数量" min-width="80px">
          <template slot-scope="scope">
            {{ scope.row.数量 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="产品详情" min-width="200px">
          <template slot-scope="scope">
            {{ scope.row.产品详情 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="其它" min-width="170px">
          <template slot-scope="scope">
            <el-input v-model="scope.row.其它" size="mini" style="width: 100%"/>
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" type="distribution" @click="submit2()">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :visible.sync="dialogFormVisible4"
      center
      width="39%">
      <el-table
        :data="tableData60"
        :header-cell-style="{background: '#383E4B',color: 'white'}"
        border
        highlight-current-row
        size="small"
        stripe
        style="width: 681px">
        <el-table-column align="center" fixed label="部件名称" width="130px">
          <template slot-scope="scope">
            <el-input v-model="scope.row.产品名称" size="mini" style="width: 100%"/>
          </template>
        </el-table-column>
        <el-table-column align="center" fixed label="单位" width="70px">
          <template slot-scope="scope">
            <el-input v-model="scope.row.单位" size="mini" style="width: 100%"/>
          </template>
        </el-table-column>
        <el-table-column align="center" fixed label="数量" width="80px">
          <template slot-scope="scope">
            <el-input v-model="scope.row.数量" size="mini" style="width: 100%"/>
          </template>
        </el-table-column>
        <el-table-column align="center" fixed label="产品详情" width="230px">
          <template slot-scope="scope">
            <el-input v-model="scope.row.产品详情" size="mini" style="width: 100%" type="textarea"/>
          </template>
        </el-table-column>
        <el-table-column align="center" label="其它" width="170px">
          <template slot-scope="scope">
            <el-input v-model="scope.row.其它" size="mini" style="width: 100%"/>
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" type="distribution" @click="submit3">确定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { MESDownloadFile } from '@/utils/request'

export default {
  data() {
    return {
      // expands: [],
      BOMSelection: '',
      numberOfParts: '',
      materialNumber: '',
      tableData13: [],
      dialogFormVisible: false,
      dialogFormVisible1: false,
      dialogFormVisible10: false,
      dialogFormVisible2: false,
      dialogFormVisible3: false,
      dialogFormVisible4: false,
      tableData5: [],
      dialogName: true,
      dialogVisibleCustomerInformation: false,
      hadFile: [],
      // 查看客户资料
      groupNum: [],
      groupNumBOM: [],
      assemblyNum: [],
      stockNum: [],
      orderValue: '',
      product: [],
      typeValue: 1,
      orderName: '',
      productValueProductLocation: '',
      CentralInternalCooling: [],
      installationDirection: [],
      TypeOfProtection: [],
      transmissionMode: [],
      transmissionModeId: '',
      transmissionModeLabel: '',
      ConnectingPlateLabel: '',
      ConnectingPlateName: '',
      ConnectingPlateId: '',
      couplingLabel: '',
      couplingName: '',
      couplingId: '',
      motorModelLabel1: '',
      motorModelName1: '',
      motorModelId1: '',
      tableData60: [],
      tableData600: [],
      tableData50: [],
      tableData500: [],
      tableData40: [],
      tableData400: [],
      tableData30: [],
      tableData300: [],
      motorModel: [],
      motorModelId: '',
      motorModelLabel: '',
      ConnectingPlate: [],
      coupling: [],
      motorModel1: [],
      spindleWheel: [], // 主轴轮数组
      motorWheel: [], // 电机轮数组
      pulley: [], // 皮带轮数组
      pullRod: [], // 拉杆数组
      bearing: [],
      bearingId: '',
      bearingLabel: '',
      multipleSelection: [],
      multipleSelection1: [],
      multipleSelection2: [],
      multipleSelection3: [],
      loading: false, // 数据加载
      total: 0, // 分页总数
      tableData: [], // 订单信息表
      tableData1: [], // 产品信息表
      tableData2: [],
      tableData3: [],
      tableData4: []
    }
  },
  computed: {
    ...mapGetters([
      'id',
      'token'
    ])
  },
  created() {
    this.searchTable()
    this.fetchData()
    this.getMotorWheel()
  },
  methods: {
    getMotorWheel() {
      var param = []
      var Data = this.CreateData('11', '传动方式_获取电机轮新', param)
      this.ExecDatabase(Data).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.motorWheel.push({
            label: response.data[i].传动方式,
            value: response.data[i].传动方式流水号
          })
        }
      })
    },
    fetchData() {
      this.getTreeData1()
      this.getTreeData2()
      this.getTreeData3()
      this.getTreeData4()
      this.getTreeData5()
      this.getTreeData6()
      var param1 = []
      var Data1 = this.CreateData('11', '中心内冷_基础表_查询数据', param1)
      this.ExecDatabase(Data1).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.CentralInternalCooling.push({
            label: response.data[i].中心内冷,
            value: response.data[i].中心内冷流水号
          })
        }
      })
      var param4 = []
      var Data4 = this.CreateData('11', '防护类型_基础表_查询数据', param4)
      this.ExecDatabase(Data4).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.TypeOfProtection.push({
            label: response.data[i].防护类型,
            value: response.data[i].防护类型流水号
          })
        }
      })
      var param7 = []
      var Data7 = this.CreateData('11', '拉杆_基础表_查询数据新', param7)
      this.ExecDatabase(Data7).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.pullRod.push({
            label: response.data[i].产品名称,
            value: response.data[i].产品流水号
          })
        }
      })
      var param8 = []
      var Data8 = this.CreateData('11', '安装方向_基础表_查询数据', param8)
      this.ExecDatabase(Data8).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.installationDirection.push({
            label: response.data[i].安装方向,
            value: response.data[i].安装方向流水号
          })
        }
      })
    },
    getTreeData1() {
      var param = []
      param[0] = ['子节点', 0]
      var Data = this.CreateData('11', '电机型号_查询节点', param)
      this.ExecDatabase(Data).then(response => {
        const data = response.data
        this.motorModel = this.tree(data, 0)
      })
    },
    getTreeData2() {
      var param = []
      param[0] = ['子节点', 0]
      var Data = this.CreateData('11', '轴承型号_查询节点', param)
      this.ExecDatabase(Data).then(response => {
        const data = response.data
        this.bearing = this.tree(data, 0)
      })
    },
    getTreeData3() {
      var param = []
      param[0] = ['子节点', 0]
      var Data = this.CreateData('11', '传动方式_查询节点_订单', param)
      this.ExecDatabase(Data).then(response => {
        const data = response.data
        this.transmissionMode = this.tree(data, 0)
      })
    },
    getTreeData4() {
      var param = []
      param[0] = ['子节点', 0]
      var Data = this.CreateData('11', '联接板_查询节点', param)
      this.ExecDatabase(Data).then(response => {
        const data = response.data
        this.ConnectingPlate = this.tree(data, 0)
      })
    },
    getTreeData5() {
      var param = []
      param[0] = ['子节点', 0]
      var Data = this.CreateData('11', '联轴器_查询节点', param)
      this.ExecDatabase(Data).then(response => {
        const data = response.data
        this.coupling = this.tree(data, 0)
      })
    },
    getTreeData6() {
      var param = []
      param[0] = ['子节点', 0]
      var Data = this.CreateData('11', '滑台电机_查询节点', param)
      this.ExecDatabase(Data).then(response => {
        const data = response.data
        this.motorModel1 = this.tree(data, 0)
      })
    },
    tree(data, pid) {
      const result = []
      let temp
      for (let i = 0; i < data.length; i++) {
        if (data[i].父节点 === pid) {
          const obj = { label: data[i].节点名称, value: data[i].子节点 }
          temp = this.tree(data, data[i].子节点)
          if (temp.length > 0) {
            obj.children = temp
          }
          result.push(obj)
        }
      }
      return result
    },
    treeToLabel(data, arr) {
      const result = []
      const childrenTreeToLabel = (data, arr, result) => {
        for (let i = 0; i < data.length; i++) {
          if (arr[0] === data[i].value) {
            result.push(data[i].label)
            if (data[i].children && arr.length > 1) {
              childrenTreeToLabel(data[i].children, arr.slice(1), result)
            }
            break
          }
        }
      }
      childrenTreeToLabel(data, arr, result)
      return result.join('/')
    },
    getData1(row) {
      this.motorModelLabel = this.treeToLabel(this.motorModel, row.电机位置)
      this.motorModelId = row.电机位置[row.电机位置.length - 1]
      const index = this.motorModelLabel.indexOf('/')
      this.motorModelLabel = this.motorModelLabel.substring(index + 1, this.motorModelLabel.length)
    },
    getData3(row) {
      this.bearingLabel = this.treeToLabel(this.bearing, row.轴承位置)
      this.bearingId = row.轴承位置[row.轴承位置.length - 1]
      const index = this.bearingLabel.indexOf('/')
      this.bearingLabel = this.bearingLabel.substring(index + 1, this.bearingLabel.length)
    },
    getData4(row) {
      this.motorModelLabel1 = this.treeToLabel(this.motorModel1, row.滑台电机位置)
      this.motorModelId1 = row.滑台电机位置[row.滑台电机位置.length - 1]
      const index = this.motorModelLabel1.indexOf('/')
      this.motorModelLabel1 = this.motorModelLabel1.substring(index + 1, this.motorModelLabel1.length)
    },
    getData5(row) {
      this.ConnectingPlateLabel = this.treeToLabel(this.ConnectingPlate, row.电机联接板)
      this.ConnectingPlateId = row.电机联接板[row.电机联接板.length - 1]
      const index = this.ConnectingPlateLabel.indexOf('/')
      this.ConnectingPlateLabel = this.ConnectingPlateLabel.substring(index + 1, this.ConnectingPlateLabel.length)
    },
    getData6(row) {
      this.couplingLabel = this.treeToLabel(this.coupling, row.联轴器)
      this.couplingId = row.联轴器[row.联轴器.length - 1]
      const index = this.couplingLabel.indexOf('/')
      this.couplingLabel = this.couplingLabel.substring(index + 1, this.couplingLabel.length)
    },
    getData2(row, index) {
      this.transmissionModeId = row.传动方式位置[row.传动方式位置.length - 1]
      this.spindleWheel = []
      this.pulley = []
      this.tableData30[index].主轴轮 = ''
      this.tableData30[index].皮带轮 = ''
      var param4 = []
      param4[0] = ['传动方式流水号', this.transmissionModeId]
      var Data4 = this.CreateData('11', '传动方式_获取名称', param4)
      this.ExecDatabase(Data4).then(response => {
        this.transmissionModeLabel = response.data[0].传动方式
      })
      var param = []
      param[0] = ['传动方式流水号', this.transmissionModeId]
      var Data = this.CreateData('11', '传动方式_获取主轴轮', param)
      this.ExecDatabase(Data).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.spindleWheel.push({
            label: response.data[i].传动方式,
            value: response.data[i].传动方式流水号
          })
        }
      })
      var Data2 = this.CreateData('11', '传动方式_获取皮带', param)
      this.ExecDatabase(Data2).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.pulley.push({
            label: response.data[i].传动方式,
            value: response.data[i].传动方式流水号
          })
        }
      })
    },
    editTable(row) {
      this.productValueProductLocation = row.产品流水号
      this.motorModelLabel = row.电机位置文本
      row.电机位置 ? this.motorModelId = row.电机位置[row.电机位置.length - 1] : this.motorModelId = null
      this.bearingLabel = row.轴承位置文本
      row.轴承位置 ? this.bearingId = row.轴承位置[row.轴承位置.length - 1] : this.bearingId = null
      this.motorModelLabel1 = row.滑台电机文本
      row.滑台电机位置 ? this.motorModelId1 = row.滑台电机位置[row.滑台电机位置.length - 1] : this.motorModelId1 = null
      this.ConnectingPlateLabel = row.电机联接板文本
      row.电机联接板 ? this.ConnectingPlateId = row.电机联接板[row.电机联接板.length - 1] : this.ConnectingPlateId = null
      this.couplingLabel = row.联轴器文本
      row.联轴器 ? this.couplingId = row.联轴器[row.联轴器.length - 1] : this.couplingId = null
      this.transmissionModeLabel = row.传动方式位置文本
      this.tableData30 = []
      this.tableData40 = []
      this.tableData50 = []
      this.tableData60 = []
      this.tableData300 = []
      this.tableData400 = []
      this.tableData500 = []
      this.tableData600 = []
      if (row.是否滑台 === 2) {
        if (row.传动方式位置) {
          this.transmissionModeId = parseInt(row.传动方式位置.split(',')[row.传动方式位置.split(',').length - 1])
        } else {
          this.transmissionModeId = null
        }
        this.spindleWheel = []
        this.pulley = []
        var param = []
        param[0] = ['传动方式流水号', this.transmissionModeId]
        var Data = this.CreateData('11', '传动方式_获取主轴轮', param)
        this.ExecDatabase(Data).then(response => {
          for (let i = 0; i < response.data.length; i++) {
            this.spindleWheel.push({
              label: response.data[i].传动方式,
              value: response.data[i].传动方式流水号
            })
          }
        })
        var Data2 = this.CreateData('11', '传动方式_获取皮带', param)
        this.ExecDatabase(Data2).then(response => {
          for (let i = 0; i < response.data.length; i++) {
            this.pulley.push({
              label: response.data[i].传动方式,
              value: response.data[i].传动方式流水号
            })
          }
        })
        this.tableData30.push({
          产品流水号: row.产品流水号,
          产品名称: row.产品名称,
          单位: row.单位,
          数量: row.数量,
          产品详情: row.产品详情,
          轴承位置: row.轴承位置 ? row.轴承位置.split(',').map(Number) : '',
          产品位置: row.产品位置 ? row.产品位置.split(',').map(Number) : '',
          安装方向: row.安装方向 ? Number(row.安装方向) : '',
          电机位置: row.电机位置 ? row.电机位置.split(',').map(Number) : '',
          传动方式位置: row.传动方式位置 ? row.传动方式位置.split(',').map(Number) : '',
          电机位置文本: row.电机位置文本,
          轴承位置文本: row.轴承位置文本,
          传动方式位置文本: row.传动方式位置文本,
          主轴轮: row.主轴轮 ? Number(row.主轴轮) : '',
          电机轮: row.电机轮 ? Number(row.电机轮) : '',
          皮带轮: row.皮带轮 ? Number(row.皮带轮) : '',
          拉杆: row.拉杆 ? Number(row.拉杆) : '',
          其它: row.其它,
          输出转速: row.输出转速,
          中心内冷: row.中心内冷 ? Number(row.中心内冷) : '',
          组件流水号: row.组件流水号
        })
        this.tableData300.push({
          产品流水号: row.产品流水号,
          产品名称: row.产品名称,
          单位: row.单位,
          数量: row.数量,
          产品详情: row.产品详情,
          轴承位置: row.轴承位置 ? row.轴承位置.split(',').map(Number) : '',
          产品位置: row.产品位置 ? row.产品位置.split(',').map(Number) : '',
          安装方向: row.安装方向 ? Number(row.安装方向) : '',
          电机位置: row.电机位置 ? row.电机位置.split(',').map(Number) : '',
          传动方式位置: row.传动方式位置 ? row.传动方式位置.split(',').map(Number) : '',
          电机位置文本: row.电机位置文本,
          轴承位置文本: row.轴承位置文本,
          传动方式位置文本: row.传动方式位置文本,
          主轴轮: row.主轴轮 ? Number(row.主轴轮) : '',
          电机轮: row.电机轮 ? Number(row.电机轮) : '',
          皮带轮: row.皮带轮 ? Number(row.皮带轮) : '',
          拉杆: row.拉杆 ? Number(row.拉杆) : '',
          其它: row.其它,
          输出转速: row.输出转速,
          中心内冷: row.中心内冷 ? Number(row.中心内冷) : '',
          组件流水号: row.组件流水号
        })
        this.dialogFormVisible10 = true
      } else if (row.是否滑台 === 1) {
        this.tableData40.push({
          产品名称: row.产品名称,
          单位: row.单位,
          数量: row.数量,
          产品详情: row.产品详情,
          防护类型: row.防护类型 ? Number(row.防护类型) : '',
          滑台电机位置: row.滑台电机位置 ? row.滑台电机位置.split(',').map(Number) : '',
          滑台电机文本: row.滑台电机文本,
          电机联接板: row.电机联接板 ? row.电机联接板.split(',').map(Number) : '',
          电机联接板文本: row.电机联接板文本,
          联轴器: row.联轴器 ? row.联轴器.split(',').map(Number) : '',
          联轴器文本: row.联轴器文本,
          组件流水号: row.组件流水号
        })
        this.tableData400.push({
          产品名称: row.产品名称,
          单位: row.单位,
          数量: row.数量,
          产品详情: row.产品详情,
          防护类型: row.防护类型 ? Number(row.防护类型) : '',
          滑台电机位置: row.滑台电机位置 ? row.滑台电机位置.split(',').map(Number) : '',
          滑台电机文本: row.滑台电机文本,
          电机联接板: row.电机联接板 ? row.电机联接板.split(',').map(Number) : '',
          电机联接板文本: row.电机联接板文本,
          联轴器: row.联轴器 ? row.联轴器.split(',').map(Number) : '',
          联轴器文本: row.联轴器文本,
          组件流水号: row.组件流水号
        })
        this.dialogFormVisible2 = true
      } else if (row.是否滑台 === 0 && row.是否合同创建 === 1) {
        this.tableData50.push({
          产品名称: row.产品名称,
          单位: row.单位,
          数量: row.数量,
          产品详情: row.产品详情,
          其它: row.其它,
          组件流水号: row.组件流水号
        })
        this.tableData500.push({
          产品名称: row.产品名称,
          单位: row.单位,
          数量: row.数量,
          产品详情: row.产品详情,
          其它: row.其它,
          组件流水号: row.组件流水号
        })
        this.dialogFormVisible3 = true
      } else {
        this.tableData60.push({
          产品名称: row.产品名称,
          单位: row.单位,
          数量: row.数量,
          产品详情: row.产品详情,
          其它: row.其它,
          组件流水号: row.组件流水号
        })
        this.tableData600.push({
          产品名称: row.产品名称,
          单位: row.单位,
          数量: row.数量,
          产品详情: row.产品详情,
          其它: row.其它,
          组件流水号: row.组件流水号
        })
        this.dialogFormVisible4 = true
      }
    },
    submit() {
      var param = []
      param[0] = ['组件流水号', this.tableData30[0].组件流水号]
      param[1] = ['轴承位置', this.tableData30[0].轴承位置]
      param[2] = ['安装方向', this.tableData30[0].安装方向]
      param[3] = ['电机位置', this.tableData30[0].电机位置]
      param[4] = ['主轴轮', this.tableData30[0].主轴轮]
      param[5] = ['电机轮', this.tableData30[0].电机轮]
      param[6] = ['皮带轮', this.tableData30[0].皮带轮]
      param[7] = ['输出转速', this.tableData30[0].输出转速]
      param[8] = ['中心内冷', this.tableData30[0].中心内冷]
      param[9] = ['传动方式位置', this.tableData30[0].传动方式位置]
      param[10] = ['原安装方向', this.tableData300[0].安装方向]
      param[11] = ['原电机位置文本', this.tableData300[0].电机位置文本]
      param[12] = ['原轴承位置文本', this.tableData300[0].轴承位置文本]
      param[13] = ['原传动方式位置文本', this.tableData300[0].传动方式位置文本]
      param[14] = ['原主轴轮', this.tableData300[0].主轴轮]
      param[15] = ['原电机轮', this.tableData300[0].电机轮]
      param[16] = ['原皮带轮', this.tableData300[0].皮带轮]
      param[17] = ['原输出转速', this.tableData300[0].输出转速]
      param[18] = ['原中心内冷', this.tableData300[0].中心内冷]
      param[19] = ['修改人', this.id]
      param[20] = ['电机位置文本', this.motorModelLabel]
      param[21] = ['轴承位置文本', this.bearingLabel]
      param[22] = ['传动方式位置文本', this.transmissionModeLabel]
      param[23] = ['拉杆', this.tableData30[0].拉杆]
      param[24] = ['原拉杆', this.tableData300[0].拉杆]
      param[25] = ['产品流水号', this.productValueProductLocation]
      param[26] = ['产品位置', this.tableData30[0].产品位置]
      param[27] = ['单位', this.tableData30[0].单位]
      param[28] = ['数量', this.tableData30[0].数量]
      param[29] = ['产品详情', this.tableData30[0].产品详情]
      param[30] = ['原产品流水号', this.tableData300[0].产品流水号]
      param[31] = ['原产品位置', this.tableData300[0].产品位置]
      param[32] = ['原单位', this.tableData300[0].单位]
      param[33] = ['原数量', this.tableData300[0].数量]
      param[34] = ['原产品详情', this.tableData300[0].产品详情]
      param[35] = ['订单编号', this.orderName]
      param[36] = ['订单流水号', this.orderValue]
      var Data = this.CreateData('12', 'PDM_组件名称_编辑数据_新动力头', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
          this.$message.success('编辑成功')
          var param = []
          param[0] = ['订单流水号', this.orderValue]
          var Data = this.CreateData('11', '订单信息_产品信息_查询数据', param)
          this.ExecDatabase(Data).then(response => {
            this.tableData1 = response.data
          })
          this.dialogFormVisible10 = false
        } else {
          this.$message.error('编辑失败')
        }
      })
    },
    submit1() {
      var param = []
      param[0] = ['组件流水号', this.tableData40[0].组件流水号]
      param[1] = ['防护类型', this.tableData40[0].防护类型]
      param[2] = ['电机联接板', this.tableData40[0].电机联接板]
      param[3] = ['电机联接板文本', this.ConnectingPlateLabel]
      param[4] = ['联轴器', this.tableData40[0].联轴器]
      param[5] = ['联轴器文本', this.couplingLabel]
      param[6] = ['滑台电机位置', this.tableData40[0].滑台电机位置]
      param[7] = ['滑台电机文本', this.motorModelLabel1]
      param[8] = ['原防护类型', this.tableData400[0].防护类型]
      param[9] = ['原电机联接板文本', this.tableData400[0].电机联接板文本]
      param[10] = ['原联轴器文本', this.tableData400[0].联轴器文本]
      param[11] = ['原滑台电机文本', this.tableData400[0].滑台电机文本]
      param[12] = ['修改人', this.id]
      param[13] = ['订单编号', this.orderName]
      param[14] = ['订单流水号', this.orderValue]
      var Data = this.CreateData('12', 'PDM_组件名称_编辑数据_滑台', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
          this.$message.success('编辑成功')
          var param = []
          param[0] = ['订单流水号', this.orderValue]
          var Data = this.CreateData('11', '订单信息_产品信息_查询数据', param)
          this.ExecDatabase(Data).then(response => {
            this.tableData1 = response.data
          })
          this.dialogFormVisible2 = false
        } else {
          this.$message.error('编辑失败')
        }
      })
    },
    submit2() {
      var param = []
      param[0] = ['组件流水号', this.tableData50[0].组件流水号]
      param[1] = ['其它', this.tableData50[0].其它]
      param[2] = ['原其它', this.tableData500[0].其它]
      param[3] = ['修改人', this.id]
      param[4] = ['订单编号', this.orderName]
      param[5] = ['订单流水号', this.orderValue]
      var Data = this.CreateData('12', 'PDM_组件名称_编辑数据_非查询创建', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
          this.$message.success('编辑成功')
          var param = []
          param[0] = ['订单流水号', this.orderValue]
          var Data = this.CreateData('11', '订单信息_产品信息_查询数据', param)
          this.ExecDatabase(Data).then(response => {
            this.tableData1 = response.data
          })
          this.dialogFormVisible3 = false
        } else {
          this.$message.error('编辑失败')
        }
      })
    },
    submit3() {
      var param = []
      param[0] = ['组件流水号', this.tableData60[0].组件流水号]
      param[1] = ['产品名称', this.tableData60[0].产品名称]
      param[2] = ['产品详情', this.tableData60[0].产品详情]
      param[3] = ['单位', this.tableData60[0].单位]
      param[4] = ['数量', this.tableData60[0].数量]
      param[5] = ['其它', this.tableData60[0].其它]
      param[6] = ['原产品名称', this.tableData600[0].产品名称]
      param[7] = ['原产品详情', this.tableData600[0].产品详情]
      param[8] = ['原单位', this.tableData600[0].单位]
      param[9] = ['原数量', this.tableData600[0].数量]
      param[10] = ['原其它', this.tableData600[0].其它]
      param[11] = ['修改人', this.id]
      param[12] = ['订单编号', this.orderName]
      param[13] = ['订单流水号', this.orderValue]
      var Data = this.CreateData('12', 'PDM_组件名称_编辑数据_查询创建', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
          this.$message.success('编辑成功')
          var param = []
          param[0] = ['订单流水号', this.orderValue]
          var Data = this.CreateData('11', '订单信息_产品信息_查询数据', param)
          this.ExecDatabase(Data).then(response => {
            this.tableData1 = response.data
          })
          this.dialogFormVisible4 = false
        } else {
          this.$message.error('编辑失败')
        }
      })
    },
    searchReason(row) {
      this.dialogFormVisible = true
      var param = []
      param[0] = ['订单流水号', row.订单流水号]
      var Data = this.CreateData('11', '车间装配管理_装配任务_打回记录_查询', param)
      this.ExecDatabase(Data).then(response => {
        this.tableData13 = response.data
      })
    },
    toogleExpand(row) {
      const $table = this.$refs.table
      this.tableData.map(item => {
        if (row.订单流水号 !== item.订单流水号) {
          $table.toggleRowExpansion(item, false)
        }
      })
      // 注意，这里的 this.list 是上面 data 中的 list
      // 通过比对数据与行里的数据，对展开行进行控制，获取对应值
      $table.toggleRowExpansion(row)
    },
    BOM(row) {
      this.tableData5 = []
      this.ccc = row.组件流水号
      console.log('BOM产品数量', row.数量)
      this.numberOfParts = row.数量
      this.materialNumber = row.物料流水号
      this.bbb = row.产品流水号
      var param = []
      param[0] = ['组件流水号', row.组件流水号]
      param[1] = ['产品流水号', row.产品流水号]
      var Data = this.CreateData('11', '订单投产_零件查询', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data.length === 0) {
          this.$message.warning('该部件无自制BOM!!')
        } else {
          console.log('查询的BOM数据', response.data)
          // this.tableData5 = response.data
          const tempList = []
          for (let i = 0; i < response.data.length; i++) {
            if (response.data[i].是否投产 === 1 || this.materialNumber > 0) {
              tempList.push({
                投产数: response.data[i].数量,
                零件名称: response.data[i].零件名称,
                图号或型号: response.data[i].图号或型号,
                材料: response.data[i].材料,
                零件备注: response.data[i].零件备注,
                类型: response.data[i].类型,
                导入时间: response.data[i].导入时间,
                库存: response.data[i].库存,
                需求量: response.data[i].需求量,
                是否投产: response.data[i].是否投产,
                图纸: response.data[i].图纸,
                流水号: response.data[i].流水号,
                导入人: response.data[i].导入人
              })
            } else {
              tempList.push({
                投产数: Number(response.data[i].数量) * Number(this.numberOfParts),
                零件名称: response.data[i].零件名称,
                图号或型号: response.data[i].图号或型号,
                材料: response.data[i].材料,
                零件备注: response.data[i].零件备注,
                类型: response.data[i].类型,
                导入时间: response.data[i].导入时间,
                库存: response.data[i].库存,
                需求量: response.data[i].需求量,
                是否投产: response.data[i].是否投产,
                图纸: response.data[i].图纸,
                流水号: response.data[i].流水号,
                导入人: response.data[i].导入人
              })
            }
          }
          this.tableData5 = tempList
          this.dialogFormVisible1 = true
        }
      })
    },
    // 加底色
    tableRowClassName({ row, rowIndex }) {
      if (row.图纸 === null) {
        return 'gray'
      } else {
        return 'red'
      }
    },
    tableRowClassName1({ row, rowIndex }) {
      if (row.专机专配期限 === null) {
        return 'gray'
      } else {
        return 'red'
      }
    },
    selectable1(row) {
      return row.图纸 !== null && row.是否投产 === 0
    },
    handleSelectionChange1(val) {
      this.BOMSelection = val
    },
    putIntoProductionBOM() {
      if (this.BOMSelection.length === 0) {
        this.$message.warning('请勾选部件')
        return
      }
      this.groupNumBOM = []
      this.numberOfProduction = []
      for (let i = 0; i < this.BOMSelection.length; i++) {
        this.groupNumBOM[i] = this.BOMSelection[i].流水号
        this.numberOfProduction[i] = this.BOMSelection[i].投产数
      }
      this.BOMSelection = []
      var param = []
      param[0] = ['基本件流水号数组', this.groupNumBOM]
      param[1] = ['投产数组', this.numberOfProduction]
      var Data = this.CreateData('12', '订单投产_BOM投产', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
          this.$message.success('投产成功')
          this.tableData5 = []
          var param1 = []
          param1[0] = ['组件流水号', this.ccc]
          param1[1] = ['产品流水号', this.bbb]
          var Data = this.CreateData('11', '订单投产_零件查询', param1)
          this.ExecDatabase(Data).then(response => {
            const tempList = []
            for (let i = 0; i < response.data.length; i++) {
              if (response.data[i].是否投产 === 1 || this.materialNumber > 0) {
                tempList.push({
                  投产数: response.data[i].数量,
                  零件名称: response.data[i].零件名称,
                  图号或型号: response.data[i].图号或型号,
                  材料: response.data[i].材料,
                  零件备注: response.data[i].零件备注,
                  类型: response.data[i].类型,
                  导入时间: response.data[i].导入时间,
                  库存: response.data[i].库存,
                  需求量: response.data[i].需求量,
                  是否投产: response.data[i].是否投产,
                  图纸: response.data[i].图纸,
                  流水号: response.data[i].流水号,
                  导入人: response.data[i].导入人
                })
              } else {
                tempList.push({
                  投产数: Number(response.data[i].数量) * Number(this.numberOfParts),
                  零件名称: response.data[i].零件名称,
                  图号或型号: response.data[i].图号或型号,
                  材料: response.data[i].材料,
                  零件备注: response.data[i].零件备注,
                  类型: response.data[i].类型,
                  导入时间: response.data[i].导入时间,
                  库存: response.data[i].库存,
                  需求量: response.data[i].需求量,
                  是否投产: response.data[i].是否投产,
                  图纸: response.data[i].图纸,
                  流水号: response.data[i].流水号,
                  导入人: response.data[i].导入人
                })
              }
            }
            this.tableData5 = tempList
          })
        } else {
          this.$message.error('投产失败')
        }
      })
    },
    cancelProduction(row) {
      var param = []
      param[0] = ['基本件流水号', row.流水号]
      var Data = this.CreateData('12', '订单投产_BOM取消投产', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
          this.$message.success('取消投产成功')
          this.tableData5 = []
          var param1 = []
          param1[0] = ['组件流水号', this.ccc]
          param1[1] = ['产品流水号', this.bbb]
          var Data = this.CreateData('11', '订单投产_零件查询', param1)
          this.ExecDatabase(Data).then(response => {
            const tempList = []
            for (let i = 0; i < response.data.length; i++) {
              if (response.data[i].是否投产 === 1 || this.materialNumber > 0) {
                tempList.push({
                  投产数: response.data[i].数量,
                  零件名称: response.data[i].零件名称,
                  图号或型号: response.data[i].图号或型号,
                  材料: response.data[i].材料,
                  零件备注: response.data[i].零件备注,
                  类型: response.data[i].类型,
                  导入时间: response.data[i].导入时间,
                  库存: response.data[i].库存,
                  需求量: response.data[i].需求量,
                  是否投产: response.data[i].是否投产,
                  图纸: response.data[i].图纸,
                  流水号: response.data[i].流水号,
                  导入人: response.data[i].导入人
                })
              } else {
                tempList.push({
                  投产数: Number(response.data[i].数量) * Number(this.numberOfParts),
                  零件名称: response.data[i].零件名称,
                  图号或型号: response.data[i].图号或型号,
                  材料: response.data[i].材料,
                  零件备注: response.data[i].零件备注,
                  类型: response.data[i].类型,
                  导入时间: response.data[i].导入时间,
                  库存: response.data[i].库存,
                  需求量: response.data[i].需求量,
                  是否投产: response.data[i].是否投产,
                  图纸: response.data[i].图纸,
                  流水号: response.data[i].流水号,
                  导入人: response.data[i].导入人
                })
              }
            }
            this.tableData5 = tempList
          })
        } else {
          this.$message.error('取消投产失败')
        }
      })
    },
    ContractPhoto(row) {
      this.hadFile = []
      var param = []
      param[0] = ['项目流水号', row.项目流水号]
      var Data = this.CreateData('11', 'PDM_项目名称_客户提供资料_查询数据', param)
      this.ExecDatabase(Data).then(res => {
        this.suffix = res.data
        if (res.data.length > 0) {
          const server = `${MESDownloadFile}`.split('/')
          res.data.map(item => {
            this.hadFile.push({
              url: `http://${server[2]}/webpage/part/${item.uid}.${item.suffix}`,
              name: `${item.name}.${item.suffix}`,
              suffix: item.suffix,
              id: item.num
            })
          })
        }
      })
      this.dialogVisibleCustomerInformation = true
    },
    searchTable() {
      var param = []
      var Data = this.CreateData('11', '订单信息_未下达_查询数据', param)
      this.ExecDatabase(Data).then(response => {
        this.tableData = []
        for (let i = 0; i < response.data.length; i++) {
          let 技术审核
          if (response.data[i].技术审核 === 1) {
            技术审核 = true
          } else {
            技术审核 = false
          }
          this.tableData.push({
            项目流水号: response.data[i].项目流水号,
            订单类型: response.data[i].订单类型,
            是否审核: response.data[i].是否审核,
            订单流水号: response.data[i].订单流水号,
            订单编号: response.data[i].订单编号,
            买方: response.data[i].买方,
            完成期限: response.data[i].完成期限,
            合同日期: response.data[i].合同日期,
            交货期限: response.data[i].交货期限,
            创建人: response.data[i].创建人,
            收货人: response.data[i].收货人,
            订单备注: response.data[i].订单备注,
            技术审核: 技术审核,
            技术: Number(response.data[i].技术审核),
            确认日期: response.data[i].确认日期,
            技术确认日期: response.data[i].审核期限,
            通用装配日期: response.data[i].通用装配期限,
            采购日期: response.data[i].采购期限,
            精工车间日期: response.data[i].精工期限,
            专机装配日期: response.data[i].专机装配期限,
            是否有打回: response.data[i].是否有打回,
            仓库: false,
            精工车间: false,
            动力头: false,
            滑台: false,
            采购: false,
            专机: false
          })
        }
      })
    },
    selectable(row) {
      return Number(row.是否分配) === 0
    },
    changeStyle({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 20 || columnIndex === 18 || columnIndex === 19 || columnIndex === 21) {
        return 'background:#31384B;color:white'
      } else {
        return 'background:#2283D4;color:white'
      }
    },
    searchTable1(row) {
      this.orderValue = row.订单流水号
      this.typeValue = row.订单类型
      this.orderName = row.订单编号
      if (row.订单类型 !== 3) {
        this.searchTable2()
      } else {
        this.searchTable3()
      }
    },
    changeA(row) {
      var param = []
      param[0] = ['订单流水号', row.订单流水号]
      if (row.技术审核) {
        param[1] = ['技术审核', 1]
      } else {
        param[1] = ['技术审核', 0]
      }
      var Data = this.CreateData('12', '订单信息_技术审核', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '0') {
          this.$message.error('操作失败')
        } else {
          this.$message.success('操作成功')
        }
      })
    },
    searchTable2() {
      this.tableData1 = []
      var param = []
      param[0] = ['订单流水号', this.orderValue]
      var Data = this.CreateData('11', '订单信息_产品信息_订单下达_查询数据', param)
      this.ExecDatabase(Data).then(response => {
        this.tableData1 = response.data
      })
    },
    searchTable3() {
      this.tableData2 = []
      var param = []
      param[0] = ['订单流水号', this.orderValue]
      param[1] = ['订单类型', this.typeValue]
      var Data = this.CreateData('11', '订单信息_补货明细_查询', param)
      this.ExecDatabase(Data).then(response => {
        this.tableData2 = response.data
      })
    },
    handleSelectionChange(val) {
      this.multipleSelection = val
    },
    editProduct(row) {
      if (row.仓库 || row.精工车间 || row.动力头 || row.滑台 || row.采购 || row.专机) {
        if (this.multipleSelection.length === 0 && Number(row.订单类型) !== 3) {
          this.$message.warning('请勾选部件')
          return
        }
        if (this.orderValue !== row.订单流水号) {
          this.$message.warning('请确保点击正确订单')
          return
        }
        var param = []
        param[0] = ['订单流水号', row.订单流水号]
        if (row.仓库) {
          param[1] = ['仓库', 1]
        } else {
          param[1] = ['仓库', 0]
        }
        if (row.精工车间) {
          param[2] = ['精工车间', 1]
        } else {
          param[2] = ['精工车间', 0]
        }
        if (row.动力头) {
          param[3] = ['动力头', 1]
        } else {
          param[3] = ['动力头', 0]
        }
        if (row.滑台) {
          param[4] = ['滑台', 1]
        } else {
          param[4] = ['滑台', 0]
        }
        if (row.采购) {
          param[5] = ['采购', 1]
        } else {
          param[5] = ['采购', 0]
        }
        if (row.专机) {
          param[6] = ['专机', 1]
        } else {
          param[6] = ['专机', 0]
        }
        if (Number(row.订单类型) === 1 || Number(row.订单类型) === 5 || Number(row.订单类型) === 6) {
          this.multipleSelection1 = this.multipleSelection
          this.multipleSelection = []
          this.groupNum = []
          for (let i = 0; i < this.multipleSelection1.length; i++) {
            if (row.动力头 === true && (this.multipleSelection1[i].是否滑台 === 1 || this.multipleSelection1[i].是否滑台 === 3)) {
              this.$message.warning('不能将滑台分配到动力头部分！')
              this.multipleSelection = this.multipleSelection1
              return
            }
            if (row.滑台 === true && (this.multipleSelection1[i].是否滑台 === 2 || this.multipleSelection1[i].是否滑台 === 4)) {
              this.$message.warning('不能将动力头分配到滑台部门！')
              this.multipleSelection = this.multipleSelection1
              return
            }
            if (row.仓库 === true && this.multipleSelection1[i].是否滑台 !== 0) {
              this.$message.warning(`${this.multipleSelection1[i].产品名称}，该部件不能直接分配至发货！`)
              this.multipleSelection = this.multipleSelection1
              return
            }
            if (row.精工车间 === true && this.multipleSelection1[i].是否滑台 !== 0) {
              this.$message.warning(`${this.multipleSelection1[i].产品名称}，该部件不能直接分配至精工车间！`)
              this.multipleSelection = this.multipleSelection1
              return
            }
            if (row.采购 === true && this.multipleSelection1[i].是否滑台 !== 0) {
              this.$message.warning(`${this.multipleSelection1[i].产品名称}，该部件不能直接分配至采购！`)
              this.multipleSelection = this.multipleSelection1
              return
            }
            if (this.multipleSelection1[i].是否导入 === 0 && this.multipleSelection1[i].物料流水号 === 0) {
              this.$message.warning(`${this.multipleSelection1[i].产品名称}，该部件无BOM`)
              this.multipleSelection = this.multipleSelection1
              return
            }
            if (this.multipleSelection1[i].是否投产 === 0 && this.multipleSelection1[i].自制件数 > 0 && !(row.采购 === true || row.仓库 === true) && this.multipleSelection1[i].是否滑台 !== 1 && this.multipleSelection1[i].是否滑台 !== 2 && this.multipleSelection1[i].物料流水号 === 0) {
              this.$message.warning(`${this.multipleSelection1[i].产品名称}，该部件中的自制BOM未投产！`)
              this.multipleSelection = this.multipleSelection1
              return
            }
            this.groupNum[i] = this.multipleSelection1[i].组件流水号
          }
        }
        if (Number(row.订单类型) === 2 || Number(row.订单类型) === 7) {
          this.multipleSelection1 = this.multipleSelection
          this.multipleSelection = []
          this.groupNum = []
          for (let i = 0; i < this.multipleSelection1.length; i++) {
            this.groupNum[i] = this.multipleSelection1[i].组件流水号
            if (this.multipleSelection1[i].是否导入 === 0 && this.multipleSelection1[i].物料流水号 === 0) {
              this.$message.warning(`${this.multipleSelection1[i].产品名称}，该部件无BOM`)
              this.multipleSelection = this.multipleSelection1
              return
            }
            if (this.multipleSelection1[i].是否滑台 !== 0 && row.仓库 === true) {
              this.$message.warning(`${this.multipleSelection1[i].产品名称}，该部件不能直接分配至发货！`)
              this.multipleSelection = this.multipleSelection1
              return
            }
            if (this.multipleSelection1[i].是否投产 === 0 && this.multipleSelection1[i].自制件数 > 0 && !(row.采购 === true || row.仓库 === true) && this.multipleSelection1[i].是否滑台 !== 1 && this.multipleSelection1[i].是否滑台 !== 2 && this.multipleSelection1[i].物料流水号 === 0) {
              this.$message.warning(`${this.multipleSelection1[i].产品名称}，该部件中的自制BOM未投产！`)
              this.multipleSelection = this.multipleSelection1
              return
            }
          }
        }
        if (Number(row.订单类型) === 3) {
          this.groupNum = []
          this.groupNum[0] = this.tableData2[0].组件流水号
        }
        param[7] = ['组件流水号组', this.groupNum]
        param[8] = ['人员编号', this.id]
        param[9] = ['订单类型', row.订单类型]
        param[10] = ['审核期限', row.技术确认日期]
        param[11] = ['通用装配期限', row.通用装配日期]
        param[12] = ['采购期限', row.采购日期]
        param[13] = ['精工期限', row.精工车间日期]
        param[14] = ['专机装配期限', row.专机装配日期]
        var Data = this.CreateData('12', '订单信息_订单分配', param)
        this.ExecDatabase(Data).then(response => {
          if (response.data[0].result === '1') {
            this.$message.success('投产成功')
            this.searchTable()
            if (row.订单类型 !== 3) {
              this.searchTable2()
            } else {
              this.tableData2 = []
            }
          } else {
            this.$message.error('投产失败')
          }
        })
      } else {
        this.$message.warning('请选择要投产的部门')
      }
    }
  }
}
</script>
<style scoped>
.wrapper {
  width: 90%;
  height: 50px;
  overflow: hidden;
  border: 1px solid #b8c7d9;
  /*float: left;*/
  margin: 10px;
}

.content {
  position: relative;
  padding: 8px 8px 0 8px;
}

a {
  text-decoration: none;
}

.icon {
  width: 30px;
  height: 30px;
  display: inline-block;
  margin-right: 7px;
  margin-top: 2px;
  font-size: 26px;
}

.info {
  width: 160px;
  height: 50px;
  position: absolute;
  left: 44px;
  line-height: 30px;
  display: inline-block;
  color: #999;
}
</style>

