<template>
  <div class="app-container">
    <el-card style="height: 850px">
      <div style="margin-top: 7px; margin-bottom: 7px">
        <el-input
          v-model="customerNameValue"
          style="width:200px"
          placeholder="买方名称/收货人"
          size="small"
          clearable
          @keyup.enter.native="pageCurrent = 1;pageSize = 20;searchTable()"/>
        <el-select
          v-model="orderValue"
          :remote-method="getOrder"
          style="width:200px"
          placeholder="订单编号"
          size="small"
          filterable
          clearable
          remote
          @change="pageCurrent = 1;pageSize = 20;searchTable()">
          <el-option
            v-for="item in orderArray"
            :key="item.value"
            :label="item.label"
            :value="item.value"/>
        </el-select>
        <span style="font-size: 13px;color: black">下单日期</span>
        <el-date-picker
          v-model="dateRange"
          size="small"
          type="daterange"
          align="center"
          style="width: 240px;"
          value-format="yyyy-MM-dd"
          format="yyyy-MM-dd"
          range-separator="～"
          start-placeholder="开始日期"
          end-placeholder="结束日期"
          @change="pageCurrent = 1;pageSize = 100;searchTable()"/>
        <el-input
          v-model="nextPerson"
          style="width:100px"
          placeholder="下单人"
          size="small"
          clearable
          @keyup.enter.native="pageCurrent = 1;pageSize = 20;searchTable()"/>
        <el-select
          v-model="orderStateValue"
          style="width:100px;margin-left: 10px"
          placeholder="订单状态"
          size="small"
          filterable
          clearable
          @change="pageCurrent = 1;pageSize = 20;searchTable()">
          <el-option
            v-for="item in orderState"
            :key="item.value"
            :label="item.label"
            :value="item.value"/>
        </el-select>
        <el-button
          icon="el-icon-search"
          type="primary"
          plain
          size="small"
          style="margin-left: 10px;"
          @click="pageCurrent = 1;pageSize = 20;searchTable()">查询
        </el-button>
        <el-button
          v-show="Number(token)===2"
          icon="el-icon-thumb"
          type="warning"
          plain
          size="small"
          style="margin-left: 10px;margin-right: 20%"
          @click="finish()">手动完成
        </el-button>
        <el-tooltip :open-delay="700" effect="dark" content="查看库存信息" placement="top">
          <el-button type="text" size="mini" @click="handleStock">
            <svg-icon icon-class="库存查询" style="width: 20px;height: 20px"/>
          </el-button>
        </el-tooltip>

        <el-button type="text" icon="el-icon-printer" size="mini" style="font-size: 20px" @click="exportTable()"/>
        <el-badge :value="numberModifyOrder" class="item">
          <el-button type="text" size="small" @click="viewModifyOrder()">订单修改通知</el-button>
        </el-badge>
      </div>
      <el-table
        v-loading="loading"
        ref="itemTable"
        :row-key="getRowKeys"
        :data="tableData"
        highlight-current-row
        border
        stripe
        size="small"
        style="width: 1651px"
        height="280px"
        @cell-dblclick="handleEdit"
        @row-click="searchTable1">
        <el-table-column :width="setColumnWidth('状态')" label="订单状态" align="center" prop="订单状态">
          <template slot-scope="scope">
            <el-tag v-if="scope.row.订单状态==='未审批'" type="warning" size="small" style="margin: 0px">未审批</el-tag>
            <el-tag v-if="scope.row.订单状态==='未投产'" type="warning" size="small" style="margin: 0px">未投产</el-tag>
            <el-tag
              v-if="scope.row.订单状态==='未审核'"
              type="warning"
              size="small"
              color="#fff582"
              style="margin: 0px">未审核
            </el-tag>
            <el-tag v-if="scope.row.订单状态==='已投产'" type="success" size="small" style="margin: 0px">已投产</el-tag>
            <el-tag v-if="scope.row.订单状态==='生产中'" type="primary" size="small" style="margin: 0px">生产中</el-tag>
            <el-tag
              v-if="scope.row.订单状态==='装配中'"
              type="primary"
              size="small"
              color="#9bd7fc"
              style="margin: 0px">装配中
            </el-tag>
            <el-tag v-if="scope.row.订单状态==='待发货'" type="info" size="small" style="margin: 0px">待发货</el-tag>
            <el-tag v-if="scope.row.订单状态==='已完成'" type="info" size="small" color="#9ed048" style="margin: 0px">
              已完成
            </el-tag>
            <el-tag
              v-if="scope.row.订单状态==='终止执行'"
              type="primary"
              size="small"
              color="#ef5a6e"
              style="margin: 0px">终止执行
            </el-tag>
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('订单编号')" label="订单编号" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.订单编号 }}
          </template>
        </el-table-column>
        <el-table-column width="60px" label="收货人" align="center">
          <template slot-scope="scope">
            {{ scope.row.收货人 }}
          </template>
        </el-table-column>
        <el-table-column label="订单备注" align="center">
          <template slot-scope="scope">
            {{ scope.row.订单备注 }}
          </template>
        </el-table-column>
        <el-table-column width="60px" label="投产人" align="center">
          <template slot-scope="scope">
            {{ scope.row.下达人 }}
          </template>
        </el-table-column>
        <el-table-column width="60px" label="下单人" align="center">
          <template slot-scope="scope">
            {{ scope.row.创建人 }}
          </template>
        </el-table-column>
        <el-table-column width="85px" label="下单日期" align="center">
          <template slot-scope="scope">
            {{ scope.row.创建日期 }}
          </template>
        </el-table-column>
        <el-table-column width="85px" label="投产日期" align="center">
          <template slot-scope="scope">
            {{ scope.row.下达日期 }}
          </template>
        </el-table-column>
        <el-table-column width="85px" label="技术确认" align="center">
          <template slot-scope="scope">
            {{ scope.row.审核日期 }}
          </template>
        </el-table-column>
        <el-table-column width="85px" label="技术审核" align="center">
          <template slot-scope="scope">
            {{ scope.row.审核期限 }}
          </template>
        </el-table-column>
        <el-table-column width="85px" label="通用装配" align="center">
          <template slot-scope="scope">
            {{ scope.row.装配日期 }}
          </template>
        </el-table-column>
        <el-table-column width="85px" label="通用期限" align="center">
          <template slot-scope="scope">
            {{ scope.row.通用装配期限 }}
          </template>
        </el-table-column>
        <el-table-column width="85px" label="采购/外协" align="center">
          <template slot-scope="scope">
            {{ scope.row.采购日期 }}
          </template>
        </el-table-column>
        <el-table-column width="85px" label="采购期限" align="center">
          <template slot-scope="scope">
            {{ scope.row.采购期限 }}
          </template>
        </el-table-column>
        <el-table-column width="85px" label="精工生产" align="center">
          <template slot-scope="scope">
            {{ scope.row.自制日期 }}
          </template>
        </el-table-column>
        <el-table-column width="85px" label="精工期限" align="center">
          <template slot-scope="scope">
            {{ scope.row.精工期限 }}
          </template>
        </el-table-column>
        <el-table-column width="85px" label="专机装配" align="center">
          <template slot-scope="scope">
            {{ scope.row.专机装配日期 }}
          </template>
        </el-table-column>
        <el-table-column width="85px" label="专机期限" align="center">
          <template slot-scope="scope">
            {{ scope.row.专机装配期限 }}
          </template>
        </el-table-column>
        <el-table-column width="130px" label="操作" align="center">
          <template slot-scope="scope">
            <el-tooltip :open-delay="700" effect="dark" content="查看暂停原因" placement="top">
              <el-button
                :disabled="scope.row.暂停原因数量 === '0'"
                type="text"
                icon="el-icon-search"
                size="mini"
                style="margin-right: 5px"
                @click="viewPauseReason(scope.row)"/>
            </el-tooltip>
            <el-tooltip :open-delay="500" effect="dark" content="查看客户提供资料" placement="top">
              <el-button type="text" icon="el-icon-picture-outline" size="mini" @click="ContractPhoto(scope.row)"/>
            </el-tooltip>
            <el-tooltip :open-delay="700" effect="dark" content="编辑订单备注" placement="top">
              <el-button
                :disabled="Number(token) !== 2 && Number(token) !== 3 && Number(token) !== 11 && Number(token) !== 12 && Number(token) !== 22"
                type="text"
                icon="el-icon-edit"
                size="mini"
                @click="editOrderInformation(scope.row)"/>
            </el-tooltip>
            <el-tooltip :open-delay="700" effect="dark" content="删除订单" placement="top">
              <el-button
                :disabled="Number(scope.row.是否接收)===1 || Number(scope.row.是否启用)===0 || (Number(token) !== 2 && Number(token) !== 3 && Number(token) !== 11 && Number(token) !== 12)"
                type="text"
                icon="el-icon-delete"
                size="mini"
                @click="backOrder(scope.row)"/>
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>
      <div class="block" style="margin-top: 10px;">
        <el-pagination
          :current-page="pageCurrent"
          :page-sizes="[10, 20, 30, 40, 100]"
          :page-size="pageSize"
          :total="total"
          :pager-count="5"
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="handleSizeChanges"
          @current-change="handleCurrentChanges"/>
      </div>
      <el-table
        v-if="Number(typeValue)!==3"
        :data="tableData1"
        :header-cell-style="changeStyle"
        :row-class-name="tableRowClassName"
        highlight-current-row
        border
        size="small"
        height="400px"
        style="width: 1651px">
        <el-table-column width="80px" label="部件状态" fixed align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            <el-tag v-if="scope.row.任务状态==='未下达'" type="danger" size="small" style="margin: 0px">未下达</el-tag>
            <el-tag v-if="scope.row.任务状态==='未接受'" type="warning" size="small" style="margin: 0px">未接受</el-tag>
            <el-tag v-if="scope.row.任务状态==='未开始'" type="info" size="small" style="margin: 0px">未开始</el-tag>
            <el-tag v-if="scope.row.任务状态==='加工中'" size="small" style="margin: 0px">加工中</el-tag>
            <el-tag v-if="scope.row.任务状态==='装配中'" type="primary" size="small" style="margin: 0px">装配中</el-tag>
            <el-tag v-if="scope.row.任务状态==='完成'" type="success" size="small" style="margin: 0px">完成</el-tag>
          </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="70px" label="单位" fixed align="center">
          <template slot-scope="scope">
            {{ scope.row.单位 }}
          </template>
        </el-table-column>
        <el-table-column width="70px" 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="90px" label="轴承型号" align="center">
          <template slot-scope="scope">
            {{ scope.row.轴承位置文本 }}
          </template>
        </el-table-column>
        <el-table-column width="75px" label="安装方向" align="center">
          <template slot-scope="scope">
            {{ scope.row.安装方向名称 }}
          </template>
        </el-table-column>
        <el-table-column width="120px" 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="98px" label="主轴轮" align="center">
          <template slot-scope="scope">
            {{ scope.row.主轴轮名称 }}
          </template>
        </el-table-column>
        <el-table-column width="98px" 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="75px" 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="setColumnWidth('防护类型')" label="防护类型" align="center">
          <template slot-scope="scope">
            {{ scope.row.防护类型名称 }}
          </template>
        </el-table-column>
        <el-table-column width="120px" label="电机型号" align="center">
          <template slot-scope="scope">
            {{ scope.row.滑台电机文本 }}
          </template>
        </el-table-column>
        <el-table-column width="120px" label="电机联接板" align="center">
          <template slot-scope="scope">
            {{ scope.row.电机联接板文本 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('联轴器')" label="联轴器" align="center">
          <template slot-scope="scope">
            {{ scope.row.联轴器文本 }}
          </template>
        </el-table-column>
        <el-table-column width="100px" label="下达部门" align="center">
          <template slot-scope="scope">
            {{ scope.row.组件部门 }}
          </template>
        </el-table-column>
        <el-table-column label="操作" width="250px" fixed="right" align="center">
          <template slot-scope="scope">
            <el-tooltip :open-delay="500" effect="dark" content="装配BOM" placement="top">
              <el-button
                :disabled="Number(scope.row.是否分配)===0"
                size="mini"
                type="text"
                icon="el-icon-document"
                @click="AssemblyBOM(scope.row)"/>
            </el-tooltip>
            <el-tooltip :open-delay="500" effect="dark" content="BOM" placement="top">
              <el-button
                :disabled="Number(scope.row.是否分配)===0"
                size="mini"
                type="text"
                icon="el-icon-document"
                @click="BOM(scope.row)"/>
            </el-tooltip>
            <el-tooltip :open-delay="500" effect="dark" content="修改参数" placement="top">
              <el-button
                :disabled="Number(orderStateName)===0 || prohibit || (Number(token) !== 2 && Number(token) !== 3 && Number(token) !== 11 && Number(token) !== 22)"
                icon="el-icon-edit"
                type="text"
                size="mini"
                @click="editTable(scope.row)"/>
            </el-tooltip>
            <el-tooltip :open-delay="500" effect="dark" content="查看修改记录" placement="top">
              <el-button
                :disabled="scope.row.参数条数 === 0 || prohibit"
                icon="el-icon-search"
                type="text"
                size="mini"
                @click="selectTable(scope.row)"/>
            </el-tooltip>
            <el-tooltip :open-delay="500" effect="dark" content="删除部件" placement="top">
              <el-button
                :disabled="scope.row.是否合同创建 === 1 || prohibit || (Number(token) !== 2 && Number(token) !== 3 && Number(token) !== 11 && Number(token) !== 12 && Number(token) !== 22)"
                icon="el-icon-delete"
                type="text"
                size="mini"
                @click="deleteTable(scope.row)"/>
            </el-tooltip>
            <el-button
              :disabled="Number(scope.row.订单类型)!==1 || !(scope.row.组件部门) || prohibit || (Number(token) !== 2 && Number(token) !== 3 && Number(token) !== 11 && Number(token) !== 12 && Number(token) !== 22)"
              type="text"
              size="mini"
              @click="editDepartment(scope.row)">修改部门
            </el-button>
          </template>
        </el-table-column>
      </el-table>
      <el-button
        v-if="Number(typeValue)!==3"
        :disabled="prohibit"
        icon="el-icon-circle-plus-outline"
        size="mini"
        @click="createProduct"/>
      <el-table
        v-if="Number(typeValue)===3"
        :data="tableData2"
        :header-cell-style="{background: '#2283D4',color: 'white'}"
        highlight-current-row
        border
        stripe
        size="mini"
        style="width: 801px;margin-top: 10px"
        height="400px">
        <el-table-column width="250px" label="物料名称" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.物料名称 }}
          </template>
        </el-table-column>
        <el-table-column width="120px" label="图号或型号" align="center">
          <template slot-scope="scope">
            {{ scope.row.图号或型号 }}
          </template>
        </el-table-column>
        <el-table-column width="60px" 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 label="操作" width="100px" fixed="right" align="center">
          <template slot-scope="scope">
            <el-button
              :disabled="prohibit || (Number(token)!==2 && Number(token)!==12 && Number(token)!==7 && Number(token)!==22)"
              icon="el-icon-edit"
              type="text"
              size="mini"
              @click="editNumber(scope.row)"/>
            <el-button
              :disabled="scope.row.条数 === 0 || prohibit"
              icon="el-icon-search"
              type="text"
              size="mini"
              @click="searchNumber(scope.row)"/>
          </template>
        </el-table-column>
      </el-table>
    </el-card>
    <el-card v-show="false" style="width:770px;margin-left: 20px;float:left">
      <div id="WGBLD" style="width: 710px;margin: 0 auto">
        <div style="height: 65px;width: 430px;margin: 0 auto 10px">
          <img src="../../../assets/img/CompanyIcon.png" style="float: left; width: 120px;height: 40px;">
          <img src="@/assets/img/CompanyQRCode.jpg" style="float: right; width: 60px;height: 60px;">
          <span style="font-size: 20px">浙江景耀数控科技有限公司</span>
        </div>
        <div style="text-align: center;margin-bottom: 10px">
          <span style="font-size: 18px;">生 产 订 单</span>
        </div>
        <table cellspacing="0px" align="center" border="1 solid black" style="font-size: 16px" width="100%">
          <tr id="tablehead12" style="height: 35px">
            <td colspan="2" style="text-align: center;width: 25%">下单人员：</td>
            <td colspan="2" style="text-align: center;width: 25%">{{ orderPersonnel }}</td>
            <td colspan="1" style="text-align: center;width: 12.5%">订单号:</td>
            <td colspan="3" style="text-align: center;width: 37.5%">{{ orderNumber }}</td>
          </tr>
          <tr style="height: 40px">
            <td colspan="1" style="text-align: center;width: 12.5%">收货人:</td>
            <td colspan="1" style="text-align: center;width: 12.5%">{{ consignee }}</td>
            <td colspan="1" style="text-align: center;width: 12.5%">下单日期:</td>
            <td colspan="2" style="text-align: center;width: 25%">{{ orderDate }}</td>
            <td colspan="1" style="text-align: center;width: 12.5%">完成期限：</td>
            <!--            <td colspan="1" style="text-align: center;width: 29%">{{ deliveryDate }}</td>-->
            <td colspan="2" style="text-align: center;width: 25%">{{ deliveryDate }}</td>
          </tr>
          <tr style="height: 40px">
            <td colspan="3" style="text-align: center;width: 20%">产品名称</td>
            <td colspan="1" style="text-align: center;width: 8%">数量</td>
            <td colspan="4" style="text-align: center;width: 60%">客户需求</td>
          </tr>
          <tr v-for="(list, index) in productInformation1" :key="index" style="height: 35px">
            <td colspan="3" style="text-align: center;width: 20%">{{ list.产品名称 }}</td>
            <td colspan="1" style="text-align: center;width: 8%">{{ list.数量 }}</td>
            <td colspan="4" style="text-align: center;width: 60%">{{ list.产品详情 }}</td>
          </tr>
          <tr style="height: 40px">
            <td colspan="8" style="text-align: center;width: 100%;letter-spacing: 5px">配件明细表</td>
          </tr>
          <tr style="height: 40px">
            <td colspan="1" style="text-align: center;width: 12%">轴承型号</td>
            <td colspan="1" style="text-align: center;width: 12%">电机型号</td>
            <td colspan="1" style="text-align: center;width: 12%">输出转速</td>
            <td colspan="1" style="text-align: center;width: 12%">安装方向</td>
            <td colspan="1" style="text-align: center;width: 12%">传动方式</td>
            <td colspan="1" style="text-align: center;width: 12%">传动带</td>
            <td colspan="1" style="text-align: center;width: 12%">主轴轮</td>
            <td colspan="1" style="text-align: center;width: 12%">电机轮</td>
          </tr>
          <tr v-for="(list, index) in productInformation" :key="'info2-'+index" style="height: 40px">
            <td colspan="1" style="text-align: center;width: 12%">{{ list.轴承型号 }}</td>
            <td colspan="1" style="text-align: center;width: 12%">{{ list.电机型号 }}</td>
            <td colspan="1" style="text-align: center;width: 12%">{{ list.输出转速 }}</td>
            <td colspan="1" style="text-align: center;width: 12%">{{ list.安装方向 }}</td>
            <td colspan="1" style="text-align: center;width: 12%">{{ list.传动方式 }}</td>
            <td colspan="1" style="text-align: center;width: 12%">{{ list.传动带 }}</td>
            <td colspan="1" style="text-align: center;width: 12%">{{ list.主轴轮 }}</td>
            <td colspan="1" style="text-align: center;width: 12%">{{ list.电机轮 }}</td>
          </tr>
          <tr style="height: 40px">
            <td colspan="1" style="text-align: center;width: 10%">备 注:</td>
            <td colspan="7" style="text-align: center;width: 10%">{{ orderRemarksPrint }}</td>
          </tr>
        </table>
        <br>
        <div style="display: inline;margin-left: 15px;font-size: 16px">审 核 1：</div>
        <div style="display: inline;margin-left: 105px;font-size: 16px">审 核 2：</div>
        <div style="display: inline;margin-left: 105px;font-size: 16px">跟 单：</div>
        <div style="height: 50px"/>
        <div style="display: inline;margin-left: 15px;font-size: 16px">装配人员：</div>
        <div style="display: inline;margin-left: 90px;font-size: 16px">检验人员：</div>
        <div style="display: inline;margin-left: 90px;font-size: 16px">装箱人员：</div>
        <div style="display: inline;margin-left: 90px;font-size: 16px">发货人员：</div>
        <div style="height: 50px"/>
        <div style="display: inline;margin-left: 365px;font-size: 16px">完成时间：</div>
        <div style="height: 50px"/>
      </div>
    </el-card>
    <el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible" center width="770px">
      <div style="width: 100%;overflow: hidden">
        <el-input
          v-model="materialNameTypeValue"
          style="width:200px"
          placeholder="物料名称规格型号"
          size="small"
          clearable
          @keyup.enter.native="pageCurrent10=1;searchTable10()"/>
        <el-table
          ref="table"
          :data="tableData7"
          :header-cell-style="{background: '#383E4B',color: 'white'}"
          highlight-current-row
          show-summary
          border
          stripe
          size="small"
          style="width: 721px"
          height="440px"
          @sort-change="sortChange">
          <el-table-column
            width="140px"
            label="物料编号"
            align="center"
            show-overflow-tooltip
            sortable="物料编码"
            prop="物料编码">
            <template slot-scope="scope">
              {{ scope.row.物料编码 }}
            </template>
          </el-table-column>
          <el-table-column
            width="170px"
            label="物料名称"
            align="center"
            show-overflow-tooltip
            sortable="物料名称"
            prop="物料名称">
            <template slot-scope="scope">
              {{ scope.row.物料名称 }}
            </template>
          </el-table-column>
          <el-table-column width="150px" label="图号型号" align="center">
            <template slot-scope="scope">
              {{ scope.row.图号或型号 }}
            </template>
          </el-table-column>
          <el-table-column :width="setColumnWidth('数量')" label="外库存" prop="预库存" align="center">
            <template slot-scope="scope">
              {{ scope.row.预库存 }}
            </template>
          </el-table-column>
          <el-table-column :width="setColumnWidth('数量')" label="库存" prop="库存" align="center">
            <template slot-scope="scope">
              {{ scope.row.库存 }}
            </template>
          </el-table-column>
          <el-table-column label="单位" align="center">
            <template slot-scope="scope">
              {{ scope.row.单位 }}
            </template>
          </el-table-column>
        </el-table>
        <div class="block" style="margin-top: 10px;">
          <el-pagination
            :current-page="pageCurrent10"
            :page-sizes="[10, 20, 30, 40, 100]"
            :page-size="pageSize10"
            :total="total10"
            layout="total, sizes, prev, pager, next, jumper"
            @size-change="handleSizeChanges10"
            @current-change="handleCurrentChanges10"/>
        </div>
      </div>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :visible.sync="dialogFormVisible1"
      center
      width="83%">
      <el-table
        :data="tableData3"
        :header-cell-style="{background: '#383E4B',color: 'white'}"
        highlight-current-row
        border
        stripe
        size="small"
        style="width: 1551px">
        <el-table-column width="200px" fixed label="部件名称" align="center">
          <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 width="100px" label="单位" fixed align="center">
          <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 width="80px" label="数量" fixed align="center">
          <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 width="200px" label="产品详情" fixed align="center">
          <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 width="230px" label="轴承型号" align="center">
          <template slot-scope="scope">
            <el-cascader
              ref="cascader"
              v-model="scope.row.轴承位置"
              :options="bearing"
              style="width: 100%"
              size="small"
              @change="getData3(scope.row)"
              @dblclick.native.stop/>
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('安装方向')" label="安装方向" align="center">
          <template slot-scope="scope">
            <el-select v-model="scope.row.安装方向" filterable clearable 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 width="300px" label="电机型号" align="center">
          <template slot-scope="scope">
            <el-cascader
              ref="cascader1"
              v-model="scope.row.电机位置"
              :options="motorModel"
              style="width: 100%"
              size="small"
              clearable
              @change="getData1(scope.row, scope.$index)"/>
          </template>
        </el-table-column>
        <el-table-column width="150px" label="传动方式" align="center">
          <template slot-scope="scope">
            <el-cascader
              ref="cascader"
              :show-all-levels="false"
              v-model="scope.row.传动方式位置"
              :options="transmissionMode"
              style="width: 100%"
              size="small"
              clearable
              @change="getData2(scope.row, scope.$index)"/>
          </template>
        </el-table-column>
        <el-table-column width="190px" label="主轴轮" align="center">
          <template slot-scope="scope">
            <el-select v-model="scope.row.主轴轮" filterable clearable 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 width="190px" label="电机轮" align="center">
          <template slot-scope="scope">
            <el-select v-model="scope.row.电机轮" filterable clearable 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 width="180px" label="传动带" align="center">
          <template slot-scope="scope">
            <el-select v-model="scope.row.皮带轮" filterable clearable 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 width="180px" label="拉杆" align="center">
          <template slot-scope="scope">
            <el-select v-model="scope.row.拉杆" filterable clearable 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('输出转速')" label="输出转速" align="center">
          <template slot-scope="scope">
            <el-input v-model="scope.row.输出转速" size="mini" style="width: 100%"/>
          </template>
        </el-table-column>
        <el-table-column width="160px" label="中心内冷" align="center">
          <template slot-scope="scope">
            <el-select v-model="scope.row.中心内冷" filterable clearable 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 type="distribution" size="small" @click="submit()">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :visible.sync="dialogFormVisible10"
      center
      width="82%">
      <el-table
        :data="tableData10"
        :header-cell-style="{background: '#383E4B',color: 'white'}"
        highlight-current-row
        border
        stripe
        size="small"
        style="width: 1516px">
        <el-table-column width="130px" fixed label="部件名称" align="center">
          <template slot-scope="scope">
            {{ scope.row.产品名称 }}
          </template>
        </el-table-column>
        <el-table-column width="70px" label="单位" fixed align="center">
          <template slot-scope="scope">
            {{ scope.row.单位 }}
          </template>
        </el-table-column>
        <el-table-column width="75px" label="数量" fixed align="center">
          <template slot-scope="scope">
            {{ scope.row.数量 }}
          </template>
        </el-table-column>
        <el-table-column width="200px" label="产品详情" fixed 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="120px" 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="100px" label="主轴轮" align="center">
          <template slot-scope="scope">
            {{ scope.row.主轴轮名称 }}
          </template>
        </el-table-column>
        <el-table-column width="100px" label="电机轮" align="center">
          <template slot-scope="scope">
            {{ scope.row.电机轮名称 }}
          </template>
        </el-table-column>
        <el-table-column width="100px" label="传动带" align="center">
          <template slot-scope="scope">
            {{ scope.row.皮带轮名称 }}
          </template>
        </el-table-column>
        <el-table-column width="100px" 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="100px" 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="100px" label="修改时间" align="center">
          <template slot-scope="scope">
            {{ scope.row.修改时间 }}
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :visible.sync="dialogFormVisible2"
      center
      width="60%">
      <el-table
        :data="tableData4"
        :header-cell-style="{background: '#383E4B',color: 'white'}"
        highlight-current-row
        border
        stripe
        size="small"
        style="width: 1091px">
        <el-table-column width="130px" label="部件名称" align="center">
          <template slot-scope="scope">
            {{ scope.row.产品名称 }}
          </template>
        </el-table-column>
        <el-table-column width="70px" 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="200px" label="产品详情" align="center">
          <template slot-scope="scope">
            {{ scope.row.产品详情 }}
          </template>
        </el-table-column>
        <el-table-column width="150px" label="防护类型" align="center">
          <template slot-scope="scope">
            <el-select v-model="scope.row.防护类型" filterable clearable 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 width="150px" label="电机型号" align="center">
          <template slot-scope="scope">
            <el-cascader
              ref="cascader"
              :show-all-levels="false"
              v-model="scope.row.滑台电机位置"
              :options="motorModel1"
              style="width: 100%"
              size="small"
              clearable
              @change="getData4(scope.row, scope.$index)"/>
          </template>
        </el-table-column>
        <el-table-column width="150px" label="电机联接板" align="center">
          <template slot-scope="scope">
            <el-cascader
              ref="cascader"
              :show-all-levels="false"
              v-model="scope.row.电机联接板"
              :options="ConnectingPlate"
              style="width: 100%"
              size="small"
              clearable
              @change="getData5(scope.row, scope.$index)"/>
          </template>
        </el-table-column>
        <el-table-column width="160px" label="联轴器" align="center">
          <template slot-scope="scope">
            <el-cascader
              ref="cascader"
              :show-all-levels="false"
              v-model="scope.row.联轴器"
              :options="coupling"
              style="width: 100%"
              size="small"
              clearable
              @change="getData6(scope.row, scope.$index)"/>
          </template>
        </el-table-column>
      </el-table>
      <div slot="footer" class="dialog-footer">
        <el-button type="distribution" size="small" @click="submit1()">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :visible.sync="dialogFormVisible11"
      center
      width="70%">
      <el-table
        :data="tableData11"
        :header-cell-style="{background: '#383E4B',color: 'white'}"
        highlight-current-row
        border
        stripe
        size="small"
        style="width: 1281px">
        <el-table-column width="130px" fixed label="部件名称" align="center">
          <template slot-scope="scope">
            {{ scope.row.产品名称 }}
          </template>
        </el-table-column>
        <el-table-column width="70px" label="单位" fixed align="center">
          <template slot-scope="scope">
            {{ scope.row.单位 }}
          </template>
        </el-table-column>
        <el-table-column width="80px" label="数量" fixed align="center">
          <template slot-scope="scope">
            {{ scope.row.数量 }}
          </template>
        </el-table-column>
        <el-table-column width="200px" label="产品详情" fixed align="center">
          <template slot-scope="scope">
            {{ scope.row.产品详情 }}
          </template>
        </el-table-column>
        <el-table-column width="150px" label="防护类型" align="center">
          <template slot-scope="scope">
            {{ scope.row.防护类型名称 }}
          </template>
        </el-table-column>
        <el-table-column width="150px" label="电机型号" align="center">
          <template slot-scope="scope">
            {{ scope.row.滑台电机文本 }}
          </template>
        </el-table-column>
        <el-table-column width="150px" 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="100px" label="修改时间" align="center">
          <template slot-scope="scope">
            {{ scope.row.修改时间 }}
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :visible.sync="dialogFormVisible3"
      center
      width="40%">
      <el-table
        :data="tableData5"
        :header-cell-style="{background: '#383E4B',color: 'white'}"
        highlight-current-row
        border
        stripe
        size="small"
        style="width: 99%;">
        <el-table-column min-width="130px" label="部件名称" align="center">
          <template slot-scope="scope">
            {{ scope.row.产品名称 }}
          </template>
        </el-table-column>
        <el-table-column min-width="70px" label="单位" align="center">
          <template slot-scope="scope">
            {{ scope.row.单位 }}
          </template>
        </el-table-column>
        <el-table-column min-width="80px" label="数量" align="center">
          <template slot-scope="scope">
            {{ scope.row.数量 }}
          </template>
        </el-table-column>
        <el-table-column min-width="200px" label="产品详情" align="center">
          <template slot-scope="scope">
            {{ scope.row.产品详情 }}
          </template>
        </el-table-column>
        <el-table-column min-width="170px" label="其它" align="center">
          <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 type="distribution" size="small" @click="submit2()">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :visible.sync="dialogFormVisible12"
      center
      width="47%">
      <el-table
        :data="tableData12"
        :header-cell-style="{background: '#383E4B',color: 'white'}"
        highlight-current-row
        border
        stripe
        size="small"
        style="width: 841px">
        <el-table-column width="130px" fixed label="部件名称" align="center">
          <template slot-scope="scope">
            {{ scope.row.产品名称 }}
          </template>
        </el-table-column>
        <el-table-column width="70px" label="单位" fixed align="center">
          <template slot-scope="scope">
            {{ scope.row.单位 }}
          </template>
        </el-table-column>
        <el-table-column width="80px" label="数量" fixed align="center">
          <template slot-scope="scope">
            {{ scope.row.数量 }}
          </template>
        </el-table-column>
        <el-table-column width="200px" label="产品详情" fixed align="center">
          <template slot-scope="scope">
            {{ scope.row.产品详情 }}
          </template>
        </el-table-column>
        <el-table-column width="170px" 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="100px" label="修改时间" align="center">
          <template slot-scope="scope">
            {{ scope.row.修改时间 }}
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :visible.sync="dialogFormVisible4"
      center
      width="39%">
      <el-table
        :data="tableData6"
        :header-cell-style="{background: '#383E4B',color: 'white'}"
        highlight-current-row
        border
        stripe
        size="small"
        style="width: 681px">
        <el-table-column width="130px" fixed label="部件名称" align="center">
          <template slot-scope="scope">
            <el-input v-model="scope.row.产品名称" size="mini" style="width: 100%"/>
          </template>
        </el-table-column>
        <el-table-column width="70px" label="单位" fixed align="center">
          <template slot-scope="scope">
            <el-input v-model="scope.row.单位" size="mini" style="width: 100%"/>
          </template>
        </el-table-column>
        <el-table-column width="80px" label="数量" fixed align="center">
          <template slot-scope="scope">
            <el-input v-model="scope.row.数量" size="mini" style="width: 100%"/>
          </template>
        </el-table-column>
        <el-table-column width="230px" label="产品详情" fixed align="center">
          <template slot-scope="scope">
            <el-input v-model="scope.row.产品详情" size="mini" type="textarea" style="width: 100%"/>
          </template>
        </el-table-column>
        <el-table-column width="170px" label="其它" align="center">
          <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 type="distribution" size="small" @click="submit3">确定</el-button>
      </div>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :visible.sync="dialogFormVisible13"
      center
      width="49%">
      <el-table
        :data="tableData13"
        :header-cell-style="{background: '#383E4B',color: 'white'}"
        highlight-current-row
        border
        stripe
        size="small"
        style="width: 871px">
        <el-table-column width="130px" fixed label="部件名称" align="center">
          <template slot-scope="scope">
            {{ scope.row.产品名称 }}
          </template>
        </el-table-column>
        <el-table-column width="70px" label="单位" fixed align="center">
          <template slot-scope="scope">
            {{ scope.row.单位 }}
          </template>
        </el-table-column>
        <el-table-column width="80px" label="数量" fixed align="center">
          <template slot-scope="scope">
            {{ scope.row.数量 }}
          </template>
        </el-table-column>
        <el-table-column width="230px" label="产品详情" fixed align="center">
          <template slot-scope="scope">
            {{ scope.row.产品详情 }}
          </template>
        </el-table-column>
        <el-table-column width="170px" 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="100px" label="修改时间" align="center">
          <template slot-scope="scope">
            {{ scope.row.修改时间 }}
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible5" title="修改数量" center width="320px">
      <el-form
        ref="form5"
        :model="form5"
        :rules="rules5"
        label-position="center"
        label-width="80px"
        class="demo-ruleForm">
        <el-form-item label="最低库存" prop="最低库存">
          <el-input-number
            v-model="form5.最低库存"
            :min="0"
            style="width:150px;"
            placeholder="最低库存"
            size="small"
            clearable/>
        </el-form-item>
        <el-form-item label="补货数" prop="补货数">
          <el-input-number
            v-model="form5.补货数"
            :min="1"
            style="width:150px;"
            placeholder="补货数"
            size="small"
            clearable/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="callOff('form5')">取消</el-button>
        <el-button type="distribution" size="small" @click="submitOrder('form5')">确定</el-button>
      </div>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :visible.sync="dialogFormVisible6"
      center
      width="33%">
      <el-table
        :data="table2"
        :header-cell-style="{background: '#383E4B',color: 'white'}"
        highlight-current-row
        border
        stripe
        size="small"
        style="width: 571px">
        <el-table-column width="200px" 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="100px" label="修改时间" align="center">
          <template slot-scope="scope">
            {{ scope.row.修改时间 }}
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible7" title="修改部门" center width="320px">
      <el-form
        ref="form7"
        :model="form7"
        :rules="rules7"
        label-position="center"
        label-width="80px"
        class="demo-ruleForm">
        <el-form-item label="部门" prop="部门">
          <el-select v-model="form7.部门" filterable clearable size="small" style="width: 90%">
            <el-option
              v-for="item in department"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="callOff7('form7')">取消</el-button>
        <el-button type="distribution" size="small" @click="submitDepartment('form7')">确定</el-button>
      </div>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :title="title"
      :visible.sync="dialogFormVisibleEditOrderInformation"
      center
      width="680px">
      <el-form
        ref="form"
        :model="form"
        :rules="rules"
        label-position="left"
        label-width="90px"
        class="demo-ruleForm"
        style="margin: auto">
        <el-row>
          <el-col :span="12">
            <el-form-item label="订单编号:" prop="订单编号">
              {{ form.订单编号 }}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="收货人:" prop="收货人">
              {{ form.收货人 }}
              <!--              <el-input v-model="form.收件人" clearable size="small" style="width:200px" placeholder="请输入客户编码"/>-->
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="技术审核:" prop="技术审核">
              <el-date-picker
                v-model="form.技术审核"
                size="small"
                align="center"
                style="width: 80%"
                value-format="yyyy-MM-dd"
                format="yyyy-MM-dd"
                placeholder="选择审核期限"
                @click.native.stop/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="采购/外购:" prop="采购">
              <el-date-picker
                v-model="form.采购"
                size="small"
                align="center"
                style="width: 80%"
                value-format="yyyy-MM-dd"
                format="yyyy-MM-dd"
                placeholder="选择采购/外购期限"
                @click.native.stop/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="精工生产:" prop="精工生产">
              <el-date-picker
                v-model="form.精工生产"
                size="small"
                align="center"
                style="width: 80%"
                value-format="yyyy-MM-dd"
                format="yyyy-MM-dd"
                placeholder="选择精益生产日期"
                @click.native.stop/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="通用装配:" prop="通用装配">
              <el-date-picker
                v-model="form.通用装配"
                size="small"
                align="center"
                style="width: 80%"
                value-format="yyyy-MM-dd"
                format="yyyy-MM-dd"
                placeholder="选择通用装配日期"
                @click.native.stop/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="专机装配:" prop="专机装配">
              <el-date-picker
                v-model="form.专机装配"
                size="small"
                align="center"
                style="width: 80%"
                value-format="yyyy-MM-dd"
                format="yyyy-MM-dd"
                placeholder="选择专机装配日期"
                @click.native.stop/>
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="订单备注:" prop="订单备注">
              <el-input
                :rows="2"
                v-model="form.orderRemarks"
                type="textarea"
                placeholder="请输入订单备注"/>
            </el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="callOffEditOrderInformation('form')">取消</el-button>
        <el-button type="distribution" size="small" @click="submitEditOrderInformation('form')">确 定</el-button>
      </div>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :visible.sync="dialogFormVisibleModifyOrder"
      center
      title="查看订单修改记录"
      width="600px">
      <el-table
        :data="tableDataVisibleModifyOrder"
        :header-cell-style="{background: '#383E4B',color: 'white'}"
        highlight-current-row
        border
        stripe
        size="small"
        height="550px"
        style="width: 571px"
        @row-click="clickModifyOrder">
        <el-table-column min-width="200px" label="订单编号" align="center">
          <template slot-scope="scope">
            {{ scope.row.订单编号 }}
          </template>
        </el-table-column>
        <el-table-column min-width="90px" label="修改人" align="center">
          <template slot-scope="scope">
            {{ scope.row.修改人姓名 }}
          </template>
        </el-table-column>
        <el-table-column min-width="100px" label="修改时间" align="center">
          <template slot-scope="scope">
            {{ scope.row.修改时间 }}
          </template>
        </el-table-column>
      </el-table>
      <div class="block" style="margin-top: 10px;">
        <el-pagination
          :current-page="pageCurrent2"
          :page-sizes="[10, 20, 30, 40, 100]"
          :page-size="pageSize2"
          :total="total2"
          :pager-count="5"
          small
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="handleSizeChanges2"
          @current-change="handleCurrentChanges2"/>
      </div>
    </el-dialog>
    <el-dialog
      v-el-drag-dialog
      :visible.sync="dialogVisible1"
      :center="dialogName"
      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="dialogFormVisible8"
      width="69%">
      <el-button type="primary" size="mini" plain @click="putIntoProductionBOM()">投 产</el-button>
      <el-table
        :data="tableData8"
        :header-cell-style="{background: '#383E4B',color: 'white'}"
        highlight-current-row
        border
        size="small"
        style="width: 1461px"
        height="580px"
        @selection-change="handleSelectionChange1">
        <el-table-column :selectable="selectable1" type="selection" align="center" width="50px"/>
        <el-table-column width="60px" label="序号" type="index" align="center"/>
        <el-table-column width="70px" label="图纸" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.图纸 ? '导入' : '未导' }}
          </template>
        </el-table-column>
        <el-table-column width="180px" label="零件名称" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.零件名称 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('图号或型号')" label="图号/型号" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.图号或型号 }}
          </template>
        </el-table-column>
        <el-table-column width="140px" label="数量" align="center" show-overflow-tooltip>
          <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 width="50px" label="库存" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.库存 }}
          </template>
        </el-table-column>
        <el-table-column width="60px" label="需求数" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.需求量 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('材料')" label="材料" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.材料 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('备注')" label="零件备注" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.零件备注 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('类型')" label="类型" align="center" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.类型 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('日期')" label="导入时间" align="center">
          <template slot-scope="scope">
            {{ scope.row.导入时间 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('姓名')" label="导入人" align="center">
          <template slot-scope="scope">
            {{ scope.row.导入人 }}
          </template>
        </el-table-column>
        <el-table-column label="投产状态" align="center">
          <template slot-scope="scope">
            {{ scope.row.是否投产 ? '已投' : '未投' }}
          </template>
        </el-table-column>
        <!--<el-table-column label="操作" align="center">
          <template slot-scope="scope">
            <el-tooltip :open-delay="700" effect="dark" content="取消投产" 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="dialogFormVisibleSuspension"
      title="暂停原因"
      center
      width="780px"
      height="300px">
      <el-table
        :data="tableDataSuspension"
        stripe
        style="width: 750px;margin-top: 10px"
        border
        size="mini">
        <el-table-column width="120px" align="center" label="装配任务流水号" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.装配任务流水号 }}
          </template>
        </el-table-column>
        <el-table-column min-width="250px" align="center" label="暂停原因" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.暂停原因 }}
          </template>
        </el-table-column>
        <el-table-column width="135px" align="center" label="暂停开始时间" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.暂停开始时间 }}
          </template>
        </el-table-column>
        <el-table-column width="135px" align="center" label="暂停结束时间" show-overflow-tooltip>
          <template slot-scope="scope">
            {{ scope.row.暂停结束时间 }}
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
    <el-dialog v-el-drag-dialog :visible.sync="dialogFormVisibleBom" center width="710px">
      <el-table
        :data="tableDataBom"
        highlight-current-row
        border
        stripe
        size="small"
        style="width: 651px"
        height="650px">
        <el-table-column label="序号" type="index" align="center" width="60px"/>
        <el-table-column width="170px" label="物料名称" align="center">
          <template slot-scope="scope">
            {{ scope.row.零件名称 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('图号或型号')" label="图号/型号" align="center">
          <template slot-scope="scope">
            {{ scope.row.图号或型号 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('数量')" label="库存数" align="center">
          <template slot-scope="scope">
            {{ scope.row.库存 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('应领数')" label="应领数" align="center">
          <template slot-scope="scope">
            {{ scope.row.数量 }}
          </template>
        </el-table-column>
        <el-table-column :width="setColumnWidth('已领数')" label="已申请数" align="center">
          <template slot-scope="scope">
            {{ scope.row.已领数量 }}
          </template>
        </el-table-column>
      </el-table>
    </el-dialog>
  </div>
</template>

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

export default {
  data() {
    return {
      originalDepartment: '',
      tableDataBom: [],
      dialogFormVisibleBom: false,
      dialogFormVisibleSuspension: false,
      tableDataSuspension: [],
      productInformation: [],
      productInformation1: [],
      consignee: '',
      nextPerson: '',
      orderRemarksPrint: '',
      accessoriesDetails: [],
      orderDate: '',
      deliveryDate: '',
      tableDataVisibleModifyOrder: [],
      dialogFormVisibleModifyOrder: false,
      numberModifyOrder: '',
      orderSerialNumber: '',
      orderSerialNumberTwo: '',
      title: '',
      form: {
        订单编号: '',
        合同类型: '',
        收货人: '',
        技术审核: '',
        采购: '',
        精工生产: '',
        通用装配: '',
        orderRemarks: '',
        专机装配: ''
      },
      people: [],
      rules: {
        // 技术审核: [{ required: true, message: '请选择技术审核日期' }],
        // 采购: [{ required: true, message: '请选择采购/外购日期' }],
        // // 收货人: [{ required: true, message: '请选择技术审核日期' }],
        // 精工生产: [{ required: true, message: '请选择精工生产日期' }],
        // 通用装配: [{ required: true, message: '请选择通用装配日期' }],
        // 专机装配: [{ required: true, message: '请选择专机装配日期' }]
      },
      productValue1: '',
      productValueProductLocation: '',
      product1: [],
      typeValue: 1,
      materialNameTypeValue: '',
      orderPersonnel: '',
      orderNumber: '',
      tableData7: [],
      pageCurrent10: 1, // 分页当前页
      pageSize10: 20, // 分页每页显示条数
      total10: 0, // 分页总数
      tableData10: [],
      tableData11: [],
      tableData12: [],
      tableData13: [],
      dialogFormVisible10: false,
      dialogFormVisible11: false,
      dialogFormVisible12: false,
      dialogFormVisible13: false,
      dialogFormVisible1: false,
      dialogFormVisible8: false,
      dialogFormVisibleEditOrderInformation: false,
      tableData3: [],
      tableData30: [],
      product: [],
      motorModel: [],
      motorModelId: '',
      motorModelLabel: '',
      ConnectingPlate: [],
      coupling: [],
      motorModel1: [],
      spindleWheel: [], // 主轴轮数组
      motorWheel: [], // 电机轮数组
      pulley: [], // 皮带轮数组
      pullRod: [], // 拉杆数组
      bearing: [],
      bearingId: '',
      bearingLabel: '',
      CentralInternalCooling: [],
      installationDirection: [],
      TypeOfProtection: [],
      transmissionMode: [],
      transmissionModeId: '',
      transmissionModeLabel: '',
      ConnectingPlateLabel: '',
      ConnectingPlateName: '',
      ConnectingPlateId: '',
      couplingLabel: '',
      couplingName: '',
      couplingId: '',
      motorModelLabel1: '',
      motorModelName1: '',
      motorModelId1: '',
      productValue: '',
      dialogFormVisible2: false,
      tableData4: [],
      tableData40: [],
      dialogFormVisible3: false,
      tableData5: [],
      tableData50: [],
      dialogFormVisible4: false,
      materialValue: '',
      numberValue: '',
      isPurchase: '',
      dialogFormVisible5: false,
      form5: {
        最低库存: '',
        补货数: '',
        原最低库存: '',
        原补货数: ''
      },
      rules5: {
        最低库存: [{ required: true, message: '最低库存' }],
        补货数: [{ required: true, message: '补货数' }]
      },
      tableData6: [],
      tableData60: [],
      customerNameValue: '', // 买方名称
      customerName: [], // 买方名称数组
      orderValue: '', // 订单编号
      orderId: '',
      orderArray: [], // 订单编号数组
      dateRange: '', // 下单日期
      orderStateValue: '', // 订单状态
      orderState: [], // 合同状态数组
      orderStateName: '',
      prohibit: false,
      loading: false, // 数据加载
      dialogFormVisible6: false,
      dialogFormVisible: false,
      dialogVisible1: false,
      hadFile: [],
      dialogName: true,
      department: [
        {
          value: '发货',
          label: '发货'
        }, {
          value: '精工车间',
          label: '精工车间'
        }, {
          value: '动力头',
          label: '动力头'
        }, {
          value: '滑台',
          label: '滑台'
        }, {
          value: '采购',
          label: '采购'
        }, {
          value: '专机',
          label: '专机'
        }
      ],
      form7: {
        部门: ''
      },
      rules7: {
        部门: [{ required: true, message: '请选择部门' }]
      },
      BOMSelection: [],
      groupNumBOM: [],
      numberOfProduction: [],
      numberOfParts: '',
      bbb: '',
      ccc: '',
      tableData8: [],
      productTypeValue: '',
      groupValue: '',
      dialogFormVisible7: false,
      total: 0, // 分页总数
      total2: 0, // 分页总数
      tableData: [], // 订单信息表
      tableData1: [], // 产品信息表
      tableData2: [],
      table2: [],
      pageCurrent: 1, // 分页当前页
      pageSize: 20, // 分页每页显示条数
      pageCurrent2: 1, // 分页当前页
      pageSize2: 20, // 分页每页显示条数
      orderName: '', // 排序列名
      order: '' // 排序方式
    }
  },
  computed: {
    ...mapGetters([
      'id',
      'token'
    ])
  },
  watch: {
    '$route': {
      handler(route) {
        this.contractQueryJump(this.$route.query.合同编号)
      },
      immediate: true
    }
  },
  created() {
    this.fetchData()
    this.getTreeData()
    this.viewModifyOrderClick()
  },
  methods: {
    finish() {
      if (this.orderId) {
        this.$confirm('是否要手动完成该订单?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          var param = []
          param[0] = ['订单流水号', this.orderId]
          var Data = this.CreateData('12', '订单管理_手动完成', param)
          this.ExecDatabase(Data).then(response => {
            if (response.data[0].result === '1') {
              this.$message.success('完成成功')
              this.searchTable()
            } else {
              this.$message.error('完成失败')
            }
          })
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消'
          })
        })
      } else {
        this.$message.warning('请选择要手动完成的订单！')
      }
    },
    handleEdit(row, column) {
      if (column.label === '订单编号' && row.订单编号.substr(0, 2) !== 'BH') {
        this.$router.push({ path: '/SalesManagement/ContractSearch', query: { 订单编号: row.订单编号 }})
      }
    },
    async contractQueryJump(contractNo) {
      await this.getOrder('')
      if (contractNo) {
        console.log('this.orderArray', this.orderArray)
        let obj = {}
        obj = this.orderArray.find((item) => {
          return item.label === contractNo
        })
        this.orderValue = obj.value
        await this.searchTable()
        if (Number(this.tableData[0].订单类型) !== 3) {
          var param = []
          param[0] = ['订单流水号', obj.value]
          var Data = this.CreateData('11', '订单信息_产品信息_查询数据', param)
          this.ExecDatabase(Data).then(response => {
            this.tableData1 = response.data
            this.productInformation = []
            this.productInformation1 = []
            for (let i = 0; i < response.data.length; i++) {
              this.productInformation1.push({
                产品名称: response.data[i].产品名称,
                数量: response.data[i].数量,
                产品详情: response.data[i].产品详情
              })
              if (response.data[i].是否滑台 === 2 && (response.data[i].轴承位置文本 !== null || response.data[i].电机位置文本 || response.data[i].输出转速 || response.data[i].传动方式位置文本 || response.data[i].安装方向名称 || response.data[i].主轴轮名称 || response.data[i].电机轮名称 || response.data[i].皮带轮名称)) {
                this.productInformation.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].皮带轮名称
                })
              }
            }
          })
        } else {
          var param1 = []
          param1[0] = ['订单流水号', obj.value]
          param1[1] = ['订单类型', Number(this.tableData[0].订单类型)]
          var Data1 = this.CreateData('11', '订单信息_补货明细_查询', param1)
          this.ExecDatabase(Data1).then(response => {
            this.tableData2 = response.data
          })
        }
      } else {
        await this.searchTable()
      }
    },
    viewPauseReason(row) {
      var param = []
      param[0] = ['订单流水号', row.订单流水号]
      var Data = this.CreateData('11', '订单查询_暂停装配_暂停原因_查询', param)
      this.ExecDatabase(Data).then(response => {
        this.tableDataSuspension = response.data
      })
      this.dialogFormVisibleSuspension = true
    },
    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.dialogVisible1 = true
    },
    searchTable() {
      this.tableData1 = []
      this.tableData2 = []
      let customerNameValue_check, orderValue_check, dateRange_check, orderStateValue_check, nextPerson_check
      this.customerNameValue ? customerNameValue_check = 1 : customerNameValue_check = 0
      this.nextPerson ? nextPerson_check = 1 : nextPerson_check = 0
      this.orderValue ? orderValue_check = 1 : orderValue_check = 0
      this.dateRange ? dateRange_check = 1 : (dateRange_check = 0, this.dateRange = '')
      if (this.orderStateValue === 0) {
        orderStateValue_check = 1
      } else if (this.orderStateValue) {
        orderStateValue_check = 1
      } else {
        orderStateValue_check = 0
      }
      var param = []
      param[0] = ['买方名称_check', customerNameValue_check]
      param[1] = ['客户', this.customerNameValue]
      param[2] = ['订单编号_check', orderValue_check]
      param[3] = ['订单流水号', this.orderValue]
      param[4] = ['下单日期_check', dateRange_check]
      param[5] = ['开始时间', this.dateRange[0]]
      param[6] = ['结束时间', this.dateRange[1]]
      param[7] = ['订单状态_check', orderStateValue_check]
      param[8] = ['订单状态', this.orderStateValue]
      param[9] = ['创建人_check', nextPerson_check]
      param[10] = ['创建人', this.nextPerson]
      var Data = this.CreateData('11', '订单信息_查询数据_加收货人', param, this.pageSize, this.pageCurrent)
      return new Promise(resolve => {
        this.ExecDatabase(Data).then(response => {
          this.tableData = response.data.rows
          this.total = response.data.total
          resolve()
        })
      })
    },
    searchTable2() {
      this.tableData1 = []
      this.tableData2 = []
      let customerNameValue_check, orderValue_check, dateRange_check, orderStateValue_check
      this.customerNameValue ? customerNameValue_check = 1 : customerNameValue_check = 0
      this.orderValue ? orderValue_check = 1 : orderValue_check = 0
      this.dateRange ? dateRange_check = 1 : (dateRange_check = 0, this.dateRange = '')
      if (this.orderStateValue === 0) {
        orderStateValue_check = 1
      } else if (this.orderStateValue) {
        orderStateValue_check = 1
      } else {
        orderStateValue_check = 0
      }
      var param = []
      param[0] = ['买方名称_check', customerNameValue_check]
      param[1] = ['客户', this.customerNameValue]
      param[2] = ['订单编号_check', orderValue_check]
      param[3] = ['订单流水号', this.orderValue]
      param[4] = ['下单日期_check', dateRange_check]
      param[5] = ['开始时间', this.dateRange[0]]
      param[6] = ['结束时间', this.dateRange[1]]
      param[7] = ['订单状态_check', orderStateValue_check]
      param[8] = ['订单状态', this.orderStateValue]
      var Data = this.CreateData('11', '订单信息_查询数据_加收货人', param, this.pageSize, this.pageCurrent)
      return new Promise(resolve => {
        this.ExecDatabase(Data).then(response => {
          this.tableData = response.data.rows
          this.total = response.data.total
          resolve()
        })
      })
    },
    viewModifyOrder() {
      this.dialogFormVisibleModifyOrder = true
      this.viewModifyOrderClick()
    },
    viewModifyOrderClick() {
      var param1 = []
      var Data1 = this.CreateData('111', 'PDM_组件名称_参数_修改记录_未查看订单_查询_BAK', param1, this.pageSize2, this.pageCurrent2)
      this.ExecDatabase(Data1).then(response => {
        if (response.data.rows.length !== 0) {
          this.numberModifyOrder = response.data.total
          this.tableDataVisibleModifyOrder = response.data.rows
          this.total2 = response.data.total
        }
      })
    },
    async clickModifyOrder(row) {
      this.orderValue = row.订单流水号
      await this.searchTable2()
      await this.searchTableModifyOrder()
      this.dialogFormVisibleModifyOrder = false
      var param = []
      param[0] = ['修改流水号', row.修改流水号]
      var Data = this.CreateData('12', 'PDM_组件名称_参数_修改记录_确认查看', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
          this.$message.success('查看修改订单成功')
          this.viewModifyOrderClick()
        } else {
          this.$message.success('查看修改订单失败')
        }
      })
    },
    searchTableModifyOrder() {
      this.orderIdA = this.tableData[0].订单流水号
      this.typeValue = this.tableData[0].订单类型
      this.orderStateName = this.tableData[0].是否提交
      this.tableData[0].是否启用 ? this.prohibit = false : this.prohibit = true
      if (Number(this.typeValue) !== 3) {
        var param = []
        param[0] = ['订单流水号', this.orderIdA]
        var Data = this.CreateData('11', '订单信息_产品信息_查询数据', param)
        this.ExecDatabase(Data).then(response => {
          this.tableData1 = response.data
        })
      } else {
        var param1 = []
        param1[0] = ['订单流水号', this.orderIdA]
        param1[1] = ['订单类型', this.typeValue]
        var Data1 = this.CreateData('11', '订单信息_补货明细_查询', param1)
        this.ExecDatabase(Data1).then(response => {
          this.tableData2 = response.data
        })
      }
    },
    getRowKeys(row) {
      return row.订单流水号
    },
    editOrderInformation(row) {
      if (this.$refs['form'] !== undefined) {
        this.$refs['form'].resetFields()
      }
      this.title = '编辑订单信息'
      this.orderSerialNumber = row.订单流水号
      this.form.订单编号 = row.订单编号
      this.form.合同类型 = row.合同类型
      this.form.收货人 = row.收货人
      this.form.技术审核 = row.审核期限
      this.form.采购 = row.采购期限
      this.form.精工生产 = row.精工期限
      this.form.通用装配 = row.通用装配期限
      this.form.专机装配 = row.专机装配期限
      this.form.orderRemarks = row.订单备注
      this.dialogFormVisibleEditOrderInformation = true
    },
    callOffEditOrderInformation(formName) {
      this.dialogFormVisibleEditOrderInformation = false
      this.orderSerialNumber = ''
      this.form.订单编号 = ''
      this.form.合同类型 = ''
      this.form.收货人 = ''
      this.form.技术审核 = ''
      this.form.采购 = ''
      this.form.精工生产 = ''
      this.form.通用装配 = ''
      this.form.专机装配 = ''
      this.form.orderRemarks = ''
      this.$refs[formName].resetFields()
    },
    submitEditOrderInformation() {
      var param = []
      param[0] = ['订单流水号', this.orderSerialNumber]
      param[1] = ['审核期限', this.form.技术审核]
      param[2] = ['采购期限', this.form.采购]
      param[3] = ['精工期限', this.form.精工生产]
      param[4] = ['通用装配期限', this.form.通用装配]
      param[5] = ['专机装配期限', this.form.专机装配]
      param[6] = ['订单备注', this.form.orderRemarks]
      var Data = this.CreateData('12', '订单查询_订单信息_修改', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
          this.$message.success('修改成功')
          this.dialogFormVisibleEditOrderInformation = false
          this.orderSerialNumber = ''
          this.form.订单编号 = ''
          this.form.合同类型 = ''
          this.form.收货人 = ''
          this.form.技术审核 = ''
          this.form.采购 = ''
          this.form.精工生产 = ''
          this.form.通用装配 = ''
          this.form.专机装配 = ''
          this.form.orderRemarks = ''
          this.searchTable()
        } else {
          this.$message.success('修改失败')
        }
      })
    },
    getTreeData() {
      var param = []
      param[0] = ['子节点', 0]
      var Data = this.CreateData('11', '订单查询_订单修改_查询节点', param)
      this.ExecDatabase(Data).then(response => {
        const data = response.data
        this.product1 = this.tree1(data, 0)
      })
    },
    tree1(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.tree1(data, data[i].子节点)
          if (temp.length > 0) {
            obj.children = temp
          }
          result.push(obj)
        }
      }
      return result
    },
    // 以上是新增
    exportTable() {
      const htmlNode = $('#WGBLD').html()
      const body = $('body')
      body.children().hide()
      const printNode = $(htmlNode)
      body.append(printNode)
      window.print()
      body.children().not('script').show()
      body.children().not('#app').hide()
      printNode.remove()
    },
    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.getCustomer()
      this.getOrderState()
      this.getTreeData1()
      this.getTreeData2()
      this.getTreeData3()
      this.getTreeData4()
      this.getTreeData5()
      this.getTreeData6()
      this.getMotorWheel()
      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].安装方向流水号
          })
        }
      })
    },
    changeStyle({ row, column, rowIndex, columnIndex }) {
      if (columnIndex === 17 || columnIndex === 18 || columnIndex === 19 || columnIndex === 20) {
        return 'background:#31384B;color:white'
      } else {
        return 'background:#2283D4;color:white'
      }
    },
    editNumber(row) {
      if (this.$refs['form5'] !== undefined) {
        this.$refs['form5'].resetFields()
      }
      this.form5.最低库存 = row.最低库存
      this.form5.补货数 = row.补货数
      this.form5.原最低库存 = row.最低库存
      this.form5.原补货数 = row.补货数
      this.numberValue = row.流水号
      this.isPurchase = row.是否采购
      this.materialValue = row.物料流水号
      this.dialogFormVisible5 = true
    },
    callOff(formName) {
      this.dialogFormVisible5 = false
      this.$refs[formName].resetFields()
    },
    searchNumber(row) {
      var param1 = []
      param1[0] = ['流水号', row.流水号]
      param1[1] = ['是否采购', row.是否采购]
      var Data1 = this.CreateData('11', '订单信息_补货明细_修改记录_查询', param1)
      this.ExecDatabase(Data1).then(response => {
        this.table2 = response.data
      })
      this.dialogFormVisible6 = true
    },
    submitOrder(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          var param = []
          param[0] = ['物料流水号', this.materialValue]
          param[1] = ['最低库存', this.form5.最低库存]
          param[2] = ['补货数', this.form5.补货数]
          param[3] = ['原最低库存', this.form5.原最低库存]
          param[4] = ['原补货数', this.form5.原补货数]
          param[5] = ['修改人', this.id]
          param[6] = ['流水号', this.numberValue]
          param[7] = ['是否采购', this.isPurchase]
          var Data = this.CreateData('12', '订单信息_补货明细_修改', param)
          this.ExecDatabase(Data).then(response => {
            if (response.data[0].result === '1') {
              this.$message.success('修改成功')
              var param1 = []
              param1[0] = ['订单流水号', this.orderId]
              param1[1] = ['订单类型', this.typeValue]
              var Data1 = this.CreateData('11', '订单信息_补货明细_查询', param1)
              this.ExecDatabase(Data1).then(response => {
                this.tableData2 = response.data
              })
              this.dialogFormVisible5 = false
            } else {
              this.$message.error('修改失败')
            }
          })
        }
      })
    },
    editDepartment(row) {
      if (this.$refs['form7'] !== undefined) {
        this.$refs['form7'].resetFields()
      }
      this.groupValue = row.组件流水号
      this.productTypeValue = row.是否滑台
      this.dialogFormVisible7 = true
      this.form7.部门 = row.组件部门
      this.originalDepartment = row.组件部门
    },
    callOff7(formName) {
      this.dialogFormVisible7 = false
      this.$refs[formName].resetFields()
    },
    submitDepartment(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          if (this.form7.部门 === '动力头' && (this.productTypeValue === 1 || this.productTypeValue === 3)) {
            this.$message.warning('不能将滑台分配到动力头部分！')
            return
          }
          if (this.form7.部门 === '滑台' && (this.productTypeValue === 2 || this.productTypeValue === 4)) {
            this.$message.warning('不能将动力头分配到滑台部门！')
            return
          }
          if (this.form7.部门 === '发货' && this.productTypeValue !== 0) {
            this.$message.warning(`该部件不能直接分配至发货！`)
            return
          }
          if (this.form7.部门 === '精工车间' && this.productTypeValue !== 0) {
            this.$message.warning(`该部件不能直接分配至精工车间！`)
            return
          }
          if (this.form7.部门 === '采购' && this.productTypeValue !== 0) {
            this.$message.warning(`该部件不能直接分配至采购！`)
            return
          }
          var param = []
          param[0] = ['组件流水号', this.groupValue]
          param[1] = ['组件部门', this.form7.部门]
          param[2] = ['修改人', this.id]
          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.orderId]
              var Data = this.CreateData('11', '订单信息_产品信息_查询数据', param)
              this.ExecDatabase(Data).then(response => {
                this.tableData1 = response.data
              })
              this.dialogFormVisible7 = false
            } else {
              this.$message.error('编辑失败')
            }
          })
        }
      })
    },
    handleStock() {
      this.dialogFormVisible = true
    },
    searchTable10() {
      let materialNameTypeValue_check
      this.materialNameTypeValue ? materialNameTypeValue_check = 1 : materialNameTypeValue_check = 0
      var param = []
      param[0] = ['物料名称_check', materialNameTypeValue_check]
      param[1] = ['物料名称', this.materialNameTypeValue]
      param[2] = ['排序名称', this.orderName]
      param[3] = ['排序方式', this.order]
      var Data = this.CreateData('11', '仓储管理_通用库存_查询', param, this.pageSize, this.pageCurrent)
      this.ExecDatabase(Data).then(response => {
        this.tableData7 = response.data.rows
        this.total = response.data.total
      })
    },
    sortChange(column) {
      if (column.prop === '状态') {
        this.orderName = 1
      }
      if (column.order === 'ascending') {
        this.order = 1
      } else if (column.order === 'descending') {
        this.order = 2
      } else {
        this.order = ''
      }
      this.searchTable10()
    },
    handleSizeChanges10(val) {
      this.pageCurrent10 = 1
      this.pageSize10 = val
      this.searchTable10()
    },
    handleCurrentChanges10(val) {
      this.pageCurrent10 = val
      this.searchTable10()
    },
    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.tableData3[index].主轴轮 = ''
      this.tableData3[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.tableData3 = []
      this.tableData4 = []
      this.tableData5 = []
      this.tableData6 = []
      this.tableData30 = []
      this.tableData40 = []
      this.tableData50 = []
      this.tableData60 = []
      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.tableData3.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.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.dialogFormVisible1 = true
      } else if (row.是否滑台 === 1) {
        this.tableData4.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.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.dialogFormVisible2 = true
      } else if (row.是否滑台 === 0 && row.是否合同创建 === 1) {
        this.tableData5.push({
          产品名称: row.产品名称,
          单位: row.单位,
          数量: row.数量,
          产品详情: row.产品详情,
          其它: row.其它,
          组件流水号: row.组件流水号
        })
        this.tableData50.push({
          产品名称: row.产品名称,
          单位: row.单位,
          数量: row.数量,
          产品详情: row.产品详情,
          其它: row.其它,
          组件流水号: row.组件流水号
        })
        this.dialogFormVisible3 = true
      } else {
        this.tableData6.push({
          产品名称: row.产品名称,
          单位: row.单位,
          数量: row.数量,
          产品详情: row.产品详情,
          其它: row.其它,
          组件流水号: row.组件流水号
        })
        this.tableData60.push({
          产品名称: row.产品名称,
          单位: row.单位,
          数量: row.数量,
          产品详情: row.产品详情,
          其它: row.其它,
          组件流水号: row.组件流水号
        })
        this.dialogFormVisible4 = true
      }
    },
    selectTable(row) {
      if (row.是否滑台 === 2) {
        var param = []
        param[0] = ['组件流水号', row.组件流水号]
        var Data = this.CreateData('11', '产品参数_修改记录_查询数据_动力头', param)
        this.ExecDatabase(Data).then(response => {
          this.tableData10 = response.data
        })
        this.dialogFormVisible10 = true
      } else if (row.是否滑台 === 1) {
        var param1 = []
        param1[0] = ['组件流水号', row.组件流水号]
        var Data1 = this.CreateData('11', '产品参数_修改记录_查询数据_滑台', param1)
        this.ExecDatabase(Data1).then(response => {
          this.tableData11 = response.data
        })
        this.dialogFormVisible11 = true
      } else if (row.是否滑台 === 0 && row.是否合同创建 === 0) {
        var param2 = []
        param2[0] = ['组件流水号', row.组件流水号]
        var Data2 = this.CreateData('11', '产品参数_修改记录_查询数据_非查询创建', param2)
        this.ExecDatabase(Data2).then(response => {
          this.tableData12 = response.data
        })
        this.dialogFormVisible12 = true
      } else {
        var param3 = []
        param3[0] = ['组件流水号', row.组件流水号]
        var Data3 = this.CreateData('11', '产品参数_修改记录_查询数据_查询创建', param3)
        this.ExecDatabase(Data3).then(response => {
          this.tableData13 = response.data
        })
        this.dialogFormVisible13 = true
      }
    },
    // getDataProductLocation(val) {
    //   this.productValueProductLocation = val[val.length - 1]
    // },
    submit() {
      var param = []
      param[0] = ['组件流水号', this.tableData3[0].组件流水号]
      param[1] = ['轴承位置', this.tableData3[0].轴承位置]
      param[2] = ['安装方向', this.tableData3[0].安装方向]
      param[3] = ['电机位置', this.tableData3[0].电机位置]
      param[4] = ['主轴轮', this.tableData3[0].主轴轮]
      param[5] = ['电机轮', this.tableData3[0].电机轮]
      param[6] = ['皮带轮', this.tableData3[0].皮带轮]
      param[7] = ['输出转速', this.tableData3[0].输出转速]
      param[8] = ['中心内冷', this.tableData3[0].中心内冷]
      param[9] = ['传动方式位置', this.tableData3[0].传动方式位置]
      param[10] = ['原安装方向', this.tableData30[0].安装方向]
      param[11] = ['原电机位置文本', this.tableData30[0].电机位置文本]
      param[12] = ['原轴承位置文本', this.tableData30[0].轴承位置文本]
      param[13] = ['原传动方式位置文本', this.tableData30[0].传动方式位置文本]
      param[14] = ['原主轴轮', this.tableData30[0].主轴轮]
      param[15] = ['原电机轮', this.tableData30[0].电机轮]
      param[16] = ['原皮带轮', this.tableData30[0].皮带轮]
      param[17] = ['原输出转速', this.tableData30[0].输出转速]
      param[18] = ['原中心内冷', this.tableData30[0].中心内冷]
      param[19] = ['修改人', this.id]
      param[20] = ['电机位置文本', this.motorModelLabel]
      param[21] = ['轴承位置文本', this.bearingLabel]
      param[22] = ['传动方式位置文本', this.transmissionModeLabel]
      param[23] = ['拉杆', this.tableData3[0].拉杆]
      param[24] = ['原拉杆', this.tableData30[0].拉杆]
      param[25] = ['产品流水号', this.productValueProductLocation]
      param[26] = ['产品位置', this.tableData3[0].产品位置]
      param[27] = ['单位', this.tableData3[0].单位]
      param[28] = ['数量', this.tableData3[0].数量]
      param[29] = ['产品详情', this.tableData3[0].产品详情]
      param[30] = ['原产品流水号', this.tableData30[0].产品流水号]
      param[31] = ['原产品位置', this.tableData30[0].产品位置]
      param[32] = ['原单位', this.tableData30[0].单位]
      param[33] = ['原数量', this.tableData30[0].数量]
      param[34] = ['原产品详情', this.tableData30[0].产品详情]
      param[35] = ['订单编号', this.orderSerialNumberTwo]
      param[36] = ['订单流水号', this.orderId]
      var Data = this.CreateData('12', 'PDM_组件名称_编辑数据_新动力头', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
          this.$message.success('编辑成功')
          this.viewModifyOrderClick()
          var param = []
          param[0] = ['订单流水号', this.orderId]
          var Data = this.CreateData('11', '订单信息_产品信息_查询数据', param)
          this.ExecDatabase(Data).then(response => {
            this.tableData1 = response.data
          })
          this.dialogFormVisible1 = false
        } else {
          this.$message.error('编辑失败')
        }
      })
    },
    submit1() {
      var param = []
      param[0] = ['组件流水号', this.tableData4[0].组件流水号]
      param[1] = ['防护类型', this.tableData4[0].防护类型]
      param[2] = ['电机联接板', this.tableData4[0].电机联接板]
      param[3] = ['电机联接板文本', this.ConnectingPlateLabel]
      param[4] = ['联轴器', this.tableData4[0].联轴器]
      param[5] = ['联轴器文本', this.couplingLabel]
      param[6] = ['滑台电机位置', this.tableData4[0].滑台电机位置]
      param[7] = ['滑台电机文本', this.motorModelLabel1]
      param[8] = ['原防护类型', this.tableData40[0].防护类型]
      param[9] = ['原电机联接板文本', this.tableData40[0].电机联接板文本]
      param[10] = ['原联轴器文本', this.tableData40[0].联轴器文本]
      param[11] = ['原滑台电机文本', this.tableData40[0].滑台电机文本]
      param[12] = ['修改人', this.id]
      param[13] = ['订单编号', this.orderSerialNumberTwo]
      param[14] = ['订单流水号', this.orderId]
      var Data = this.CreateData('12', 'PDM_组件名称_编辑数据_滑台', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
          this.$message.success('编辑成功')
          this.viewModifyOrderClick()
          var param = []
          param[0] = ['订单流水号', this.orderId]
          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.tableData5[0].组件流水号]
      param[1] = ['其它', this.tableData5[0].其它]
      param[2] = ['原其它', this.tableData50[0].其它]
      param[3] = ['修改人', this.id]
      param[4] = ['订单编号', this.orderSerialNumberTwo]
      param[5] = ['订单流水号', this.orderId]
      var Data = this.CreateData('12', 'PDM_组件名称_编辑数据_非查询创建', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
          this.$message.success('编辑成功')
          this.viewModifyOrderClick()
          var param = []
          param[0] = ['订单流水号', this.orderId]
          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.tableData6[0].组件流水号]
      param[1] = ['产品名称', this.tableData6[0].产品名称]
      param[2] = ['产品详情', this.tableData6[0].产品详情]
      param[3] = ['单位', this.tableData6[0].单位]
      param[4] = ['数量', this.tableData6[0].数量]
      param[5] = ['其它', this.tableData6[0].其它]
      param[6] = ['原产品名称', this.tableData60[0].产品名称]
      param[7] = ['原产品详情', this.tableData60[0].产品详情]
      param[8] = ['原单位', this.tableData60[0].单位]
      param[9] = ['原数量', this.tableData60[0].数量]
      param[10] = ['原其它', this.tableData60[0].其它]
      param[11] = ['修改人', this.id]
      param[12] = ['订单编号', this.orderSerialNumberTwo]
      param[13] = ['订单流水号', this.orderId]
      var Data = this.CreateData('12', 'PDM_组件名称_编辑数据_查询创建', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
          this.$message.success('编辑成功')
          this.viewModifyOrderClick()
          var param = []
          param[0] = ['订单流水号', this.orderId]
          var Data = this.CreateData('11', '订单信息_产品信息_查询数据', param)
          this.ExecDatabase(Data).then(response => {
            this.tableData1 = response.data
          })
          this.dialogFormVisible4 = false
        } else {
          this.$message.error('编辑失败')
        }
      })
    },
    createProduct() {
      if (this.orderId) {
        var param = []
        param[0] = ['订单流水号', this.orderId]
        var Data = this.CreateData('12', '订单信息_产品信息_增加数据_订单查询', param)
        this.ExecDatabase(Data).then(response => {
          if (response.data[0].result === '1') {
            this.$message.success('添加成功')
            var param = []
            param[0] = ['订单流水号', this.orderId]
            var Data = this.CreateData('11', '订单信息_产品信息_查询数据', param)
            this.ExecDatabase(Data).then(response => {
              this.tableData1 = response.data
            })
          } else {
            this.$message.error('添加失败')
          }
        })
      } else {
        this.$message.warning('请先选择订单')
      }
    },
    deleteTable(row) {
      var param = []
      param[0] = ['组件流水号', row.组件流水号]
      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.orderId]
          var Data = this.CreateData('11', '订单信息_产品信息_查询数据', param)
          this.ExecDatabase(Data).then(response => {
            this.tableData1 = response.data
          })
        } else {
          this.$message.error('删除失败')
        }
      })
    },
    getCustomer() {
      var param = []
      var Data = this.CreateData('11', '合同管理_客户信息_查询数据', param)
      this.ExecDatabase(Data).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.customerName.push({
            label: response.data[i].客户名称,
            value: response.data[i].客户流水号
          })
        }
      })
    },
    getOrder(query) {
      this.orderArray = []
      let customerNameValue_check
      this.customerNameValue ? customerNameValue_check = 1 : customerNameValue_check = 0
      var param = []
      param[0] = ['买方名称_check', customerNameValue_check]
      param[1] = ['买方名称', this.customerNameValue]
      param[2] = ['订单编号', query]
      var Data = this.CreateData('11', '订单信息_列表_通过客户_查询数据_BAK', param)
      return new Promise(resolve => {
        this.ExecDatabase(Data).then(response => {
          for (let i = 0; i < response.data.length; i++) {
            this.orderArray.push({
              label: response.data[i].订单编号,
              value: response.data[i].订单流水号
            })
          }
          resolve()
        })
      })
    },
    getOrderState() {
      var param = []
      var Data = this.CreateData('11', '订单状态_查询', param)
      this.ExecDatabase(Data).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.orderState.push({
            label: response.data[i].订单状态,
            value: response.data[i].订单状态
          })
        }
      })
    },
    backOrder(row) {
      this.$confirm('是否撤回下达?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        var param = []
        param[0] = ['订单流水号', row.订单流水号]
        var Data = this.CreateData('12', '订单信息_撤回下达', param)
        this.ExecDatabase(Data).then(response => {
          if (response.data[0].result === '1') {
            this.$message.success('撤回成功')
            this.searchTable()
            this.tableData1 = []
          } else {
            this.$message.error('撤回失败')
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消撤回'
        })
      })
    },
    searchTable1(row) {
      console.log('订单查询点击的行', row)
      this.orderNumber = row.订单编号
      this.orderRemarksPrint = row.订单备注
      this.orderPersonnel = row.创建人
      this.consignee = row.收货人
      this.orderDate = row.下达日期
      this.deliveryDate = row.完成期限
      this.orderId = row.订单流水号
      this.typeValue = row.订单类型
      this.orderSerialNumberTwo = row.订单编号
      this.orderStateName = row.是否提交
      row.是否启用 ? this.prohibit = false : this.prohibit = true
      if (Number(this.typeValue) !== 3) {
        var param = []
        param[0] = ['订单流水号', row.订单流水号]
        var Data = this.CreateData('11', '订单信息_产品信息_查询数据', param)
        this.ExecDatabase(Data).then(response => {
          this.tableData1 = response.data
          console.log('每行数据', response.data)
          this.productInformation = []
          this.productInformation1 = []
          for (let i = 0; i < response.data.length; i++) {
            this.productInformation1.push({
              产品名称: response.data[i].产品名称,
              数量: response.data[i].数量,
              产品详情: response.data[i].产品详情
            })
            if (response.data[i].是否滑台 === 2 && (response.data[i].轴承位置文本 !== null || response.data[i].电机位置文本 || response.data[i].输出转速 || response.data[i].传动方式位置文本 || response.data[i].安装方向名称 || response.data[i].主轴轮名称 || response.data[i].电机轮名称 || response.data[i].皮带轮名称)) {
              this.productInformation.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].皮带轮名称
              })
            }
          }
        })
      } else {
        var param1 = []
        param1[0] = ['订单流水号', row.订单流水号]
        param1[1] = ['订单类型', this.typeValue]
        var Data1 = this.CreateData('11', '订单信息_补货明细_查询', param1)
        this.ExecDatabase(Data1).then(response => {
          this.tableData2 = response.data
        })
      }
    },
    AssemblyBOM(row) {
      var param = []
      param[0] = ['组件流水号', row.组件流水号]
      var Data = this.CreateData('11', '装配管理_三表_查询', param)
      this.ExecDatabase(Data).then(response => {
        this.tableDataBom = response.data
        console.log('BOM信息', response.data)
        this.dialogFormVisibleBom = true
      })
    },
    BOM(row) {
      this.tableData8 = []
      this.productTypeValue = row.是否滑台
      this.ccc = row.组件流水号
      console.log('BOM产品数量', row.数量)
      this.numberOfParts = 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('该部件不包含自制件!!')
        } else {
          console.log('查询的BOM数据', response.data)
          // this.tableData5 = response.data
          for (let i = 0; i < response.data.length; i++) {
            if (response.data[i].是否投产 === 1) {
              this.tableData8.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].流水号,
                导入人: response.data[i].导入人
              })
            } else {
              this.tableData8.push({
                投产数: Number(response.data[i].是否后增) ? Number(response.data[i].数量) * Number(this.numberOfParts) : 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].库存,
                需求量: response.data[i].需求量,
                是否投产: response.data[i].是否投产,
                是否后增: response.data[i].是否后增,
                图纸: response.data[i].图纸,
                流水号: response.data[i].流水号,
                导入人: response.data[i].导入人
              })
            }
          }
          this.dialogFormVisible8 = true
        }
      })
    },
    selectable1(row) {
      return row.图纸 !== null && row.是否投产 === 0 && row.是否后增 === 1
    },
    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]
      param[2] = ['是否滑台', this.productTypeValue]
      var Data = this.CreateData('12', '订单查询_BOM投产', param)
      this.ExecDatabase(Data).then(response => {
        if (response.data[0].result === '1') {
          this.$message.success('投产成功')
          this.tableData8 = []
          var param1 = []
          param1[0] = ['组件流水号', this.ccc]
          param1[1] = ['产品流水号', this.bbb]
          var Data = this.CreateData('11', '订单投产_零件查询', param1)
          this.ExecDatabase(Data).then(response => {
            for (let i = 0; i < response.data.length; i++) {
              if (response.data[i].是否投产 === 1) {
                this.tableData8.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].流水号,
                  导入人: response.data[i].导入人
                })
              } else {
                this.tableData8.push({
                  投产数: Number(response.data[i].是否后增) ? Number(response.data[i].数量) * Number(this.numberOfParts) : 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].库存,
                  需求量: response.data[i].需求量,
                  是否投产: response.data[i].是否投产,
                  是否后增: response.data[i].是否后增,
                  图纸: response.data[i].图纸,
                  流水号: response.data[i].流水号,
                  导入人: response.data[i].导入人
                })
              }
            }
          })
        } 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.tableData8 = []
          var param1 = []
          param1[0] = ['组件流水号', this.ccc]
          param1[1] = ['产品流水号', this.bbb]
          var Data = this.CreateData('11', '订单投产_零件查询', param1)
          this.ExecDatabase(Data).then(response => {
            for (let i = 0; i < response.data.length; i++) {
              if (response.data[i].是否投产 === 1) {
                this.tableData8.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].流水号,
                  导入人: response.data[i].导入人
                })
              } else {
                this.tableData8.push({
                  投产数: Number(response.data[i].是否后增) ? Number(response.data[i].数量) * Number(this.numberOfParts) : 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].库存,
                  需求量: response.data[i].需求量,
                  是否投产: response.data[i].是否投产,
                  是否后增: response.data[i].是否后增,
                  图纸: response.data[i].图纸,
                  流水号: response.data[i].流水号,
                  导入人: response.data[i].导入人
                })
              }
            }
          })
        } else {
          this.$message.error('取消投产失败')
        }
      })
    },
    tableRowClassName({ row, rowIndex }) {
      if (Number(row.是否存在更改) === 1) {
        return 'no-accept'
      }
    },
    handleSizeChanges(val) {
      this.pageCurrent = 1
      this.pageSize = val
      this.searchTable()
    },
    handleCurrentChanges(val) {
      this.pageCurrent = val
      this.searchTable()
    },
    handleSizeChanges2(val) {
      this.pageCurrent2 = 1
      this.pageSize2 = val
      this.viewModifyOrderClick()
    },
    handleCurrentChanges2(val) {
      this.pageCurrent2 = val
      this.viewModifyOrderClick()
    }
  }
}
</script>
<style>
.el-table .no-accept {
  background: #F2D1D6 !important;
}
</style>
<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;
}

.action {
  position: absolute;
  top: 2px;
  right: 8px;
}

.delete {
  padding: 0 5px;
  border-radius: 3px;
  color: #0f84b0;
  font-size: 12px;
}

.delete:hover {
  background: -webkit-linear-gradient(top, #0ba9e3, #0099d3);
  color: #fff;
}

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>

