<template>
  <div class="app-container">
    <el-card>
      <el-select v-model="machineValue" placeholder="请选择机床图号" style="margin: 0px 20px 0px 0px" clearable filterable size="small">
        <el-option
          v-for="item in machine"
          :key="item.value"
          :label="item.label"
          :value="item.value"/>
      </el-select>

      <el-select v-model="groupValue" placeholder="请选择组号" style="margin: 0px 20px 0px 0px" filterable size="small" clearable @change="getNumber">
        <el-option
          v-for="item in group"
          :key="item.value"
          :label="item.label"
          :value="item.value"/>
      </el-select>

      <el-input v-model="partNumber" clearable filterable size="small" placeholder="零件图号或物料名称" style="width: 200px;"/>

      <el-button icon="el-icon-search" type="primary" size="small" plain @click="pageCurrentWB = 1;pageSizeWB = 10;pageCurrent = 1;pageSize = 10;getTableData();pageCurrent1 = 1;pageSize1 = 10;getTable();pageCurrent2 = 1;pageSize2 = 10;getTable1()">查询</el-button>

      <span style="margin-left: 10px">部件数量：{{ groupNumber }}</span>
      <el-button icon="el-icon-edit" type="warning" size="small" style="margin-left: 10px" plain @click="form4.数量 = groupNumber;dialogFormVisible4=true">更改部件数量</el-button>
    </el-card>
    <el-card>
      <div>
        <span style="font-size: 20px">自制件</span>
        <el-tooltip :open-delay="1000" effect="dark" content="删除基本件三表数量" placement="top">
          <el-button style="float: right;margin-bottom: 3px" type="danger" size="small" plain @click="alldelete()">全部删除</el-button>
        </el-tooltip>
      </div>
      <el-table v-loading="loading" :data="tableData" highlight-current-row border stripe size="mini" style="width: 100%;max-height: 520px" height="320" @selection-change="handleSelectionChange">
        <el-table-column :selectable="selectable" type="selection" align="center" width="45"/>
        <el-table-column label="序号" align="center" type="index" width="50"/>
        <el-table-column label="机床图号" align="center" min-width="150px">
          <template slot-scope="scope">{{ scope.row.机床图号 }}</template>
        </el-table-column>
        <el-table-column label="零件图号" align="center" min-width="200px">
          <template slot-scope="scope">{{ scope.row.零件图号 }}</template>
        </el-table-column>
        <el-table-column label="零件名称" align="center" min-width="100px">
          <template slot-scope="scope">{{ scope.row.零件名称 }}</template>
        </el-table-column>
        <el-table-column label="组号" align="center" min-width="100px">
          <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">
            {{ 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">{{ 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">{{ scope.row.零件类型名称 }}</template>
        </el-table-column>
        <el-table-column align="center" label="分类码" width="150">
          <template slot-scope="scope">
            {{ scope.row.分类码 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="旧零件图号" width="150">
          <template slot-scope="scope">
            {{ scope.row.前零件图号 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="整改类型" width="150">
          <template slot-scope="scope">
            {{ scope.row.整改类型 }}
          </template>
        </el-table-column>
        <el-table-column label="操作" fixed="right" align="center" width="100">
          <template slot-scope="scope">
            <el-tooltip :open-delay="1000" effect="dark" content="编辑零件" placement="top">
              <el-button :disabled="scope.row.考核状态>=7" size="mini" type="text" icon="el-icon-edit" @click="type=1;handleEdit(scope.row)"/>
            </el-tooltip>
            <el-tooltip :open-delay="1000" effect="dark" content="删除该行" placement="top">
              <el-button :disabled="scope.row.考核状态>=6&&scope.row.状态==='已加工'" size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"/>
            </el-tooltip>
          </template>
        </el-table-column>
      </el-table>
      <span style="font-size: 5px">共{{ totalnumber }}条信息，选择{{ gouxuan }}条</span>
      <!--<div class="block" style="margin-top: 10px;">-->
      <!--<el-pagination-->
      <!--:current-page="pageCurrent"-->
      <!--:page-sizes="[10, 20, 30, 40]"-->
      <!--:page-size="pageSize"-->
      <!--:total="total"-->
      <!--layout="total, sizes, prev, pager, next, jumper"-->
      <!--@size-change="handleSizeChanges"-->
      <!--@current-change="handleCurrentChanges"/>-->
      <!--</div>-->
    </el-card>
    <el-card>
      <div>
        <span style="font-size: 20px">外购件</span>
        <el-tooltip :open-delay="1000" effect="dark" content="删除外购件和标准件数量" placement="top">
          <el-button style="float: right;margin-bottom: 3px" type="danger" size="small" plain @click="alldeleteWB()">全部删除</el-button>
        </el-tooltip>
      </div>
      <el-table
        v-loading="loadingWB"
        :data="tableDataWB"
        style="width: 100%"
        size="mini"
        height="320"
        highlight-current-row
        border
        @selection-change="handleSelectionChange1">
        <el-table-column :selectable="selectable1" type="selection" align="center" width="45"/>
        <el-table-column
          label="序号"
          align="center"
          type="index"
          width="50"/>
        <el-table-column align="center" label="物料名称">
          <template slot-scope="scope">
            {{ scope.row.物料名称 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="物料规格">
          <template slot-scope="scope">
            {{ scope.row.物料规格 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="物料型号">
          <template slot-scope="scope">
            {{ scope.row.物料型号 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="零件数量">
          <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">
            {{ scope.row.机床数量 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="零件类型">
          <template slot-scope="scope">
            {{ scope.row.零件类型 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="供货商">
          <template slot-scope="scope">
            {{ scope.row.供货商 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="备注" width="100">
          <template slot-scope="scope">
            {{ scope.row.备注 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="标记" width="100">
          <template slot-scope="scope">
            {{ scope.row.标记 }}
          </template>
        </el-table-column>
        <el-table-column label="操作" fixed="right" align="center" width="200">
          <template slot-scope="scope">
            <el-button
              :disabled="parseInt(scope.row.询价状态编号)===3"
              size="mini"
              type="text"
              icon="el-icon-edit"
              @click="type=1;handleEdit(scope.row)"/>
            <el-button
              :disabled="parseInt(scope.row.询价状态编号)===3"
              size="mini"
              type="text"
              icon="el-icon-delete"
              @click="handleDelete(scope.row)"/>
            <el-button
              :disabled="parseInt(scope.row.询价状态编号)===3"
              size="mini"
              type="text"
              @click="materialChange(scope.row)">物料变更</el-button>
          </template>
        </el-table-column>
      </el-table>
      <!--      <div class="block" style="margin-top: 10px">-->
      <!--        <el-pagination-->
      <!--          :current-page="pageCurrentWB"-->
      <!--          :page-sizes="[10, 20, 30, 40]"-->
      <!--          :page-size="pageSizeWB"-->
      <!--          :total="totalWB"-->
      <!--          layout="total, sizes, prev, pager, next, jumper"-->
      <!--          @size-change="handleSizeChangeWB"-->
      <!--          @current-change="handleCurrentChangeWB"/>-->
      <!--      </div>-->
    </el-card>
    <!--<el-card>-->
    <!--<div>-->
    <!--<div style="font-size: 20px">未投产</div>-->
    <!--<el-table-->
    <!--:data="tableData1"-->
    <!--border-->
    <!--style="width: 100%"-->
    <!--height="320">-->
    <!--<el-table-column label="零件号" align="center" min-width="220">-->
    <!--<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">-->
    <!--{{ 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">-->
    <!--{{ 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" width="100">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.零件类型名称 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column label="操作" width="200px" fixed="right" align="center">-->
    <!--<template slot-scope="scope">-->
    <!--<el-button-->
    <!--size="mini"-->
    <!--type="text"-->
    <!--@click="type=1;handleEdit(scope.row)"/>-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--</el-table>-->
    <!--&lt;!&ndash;        <div class="block" style="margin-top: 10px;">&ndash;&gt;-->
    <!--&lt;!&ndash;          <el-pagination&ndash;&gt;-->
    <!--&lt;!&ndash;            :current-page="pageCurrent1"&ndash;&gt;-->
    <!--&lt;!&ndash;            :page-sizes="[10, 20, 30, 40]"&ndash;&gt;-->
    <!--&lt;!&ndash;            :page-size="pageSize1"&ndash;&gt;-->
    <!--&lt;!&ndash;            :total="total1"&ndash;&gt;-->
    <!--&lt;!&ndash;            style="width:50%;display:inline-block;"&ndash;&gt;-->
    <!--&lt;!&ndash;            layout="total, sizes, prev, pager, next, jumper"&ndash;&gt;-->
    <!--&lt;!&ndash;            @size-change="handleSizeChange1"&ndash;&gt;-->
    <!--&lt;!&ndash;            @current-change="handleCurrentChange1"/>&ndash;&gt;-->
    <!--&lt;!&ndash;        </div>&ndash;&gt;-->
    <!--</div>-->
    <!--</el-card>-->
    <!--<el-card>-->
    <!--<div style="font-size: 20px">未平衡</div>-->
    <!--<el-table-->
    <!--:data="tableData2"-->
    <!--border-->
    <!--style="max-height: 400px;margin-top:10px"-->
    <!--height="320">-->
    <!--<el-table-column label="零件图号" align="center" width="300">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.零件图号 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column label="零件名称" align="center" width="200">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.零件名称 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column label="零件数量" align="center" width="100">-->
    <!--<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">-->
    <!--{{ 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="操作" width="200px" fixed="right" align="center">-->
    <!--<template slot-scope="scope">-->
    <!--<el-button-->
    <!--size="mini"-->
    <!--type="text"-->
    <!--@click="handleEdit(scope.row)"/>-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--</el-table>-->
    <!--&lt;!&ndash;      <div class="block" style="margin-top: 10px;">&ndash;&gt;-->
    <!--&lt;!&ndash;        <el-pagination&ndash;&gt;-->
    <!--&lt;!&ndash;          :current-page="pageCurrent2"&ndash;&gt;-->
    <!--&lt;!&ndash;          :page-sizes="[10, 20, 30, 40]"&ndash;&gt;-->
    <!--&lt;!&ndash;          :page-size="pageSize2"&ndash;&gt;-->
    <!--&lt;!&ndash;          :total="total2"&ndash;&gt;-->
    <!--&lt;!&ndash;          style="float:left"&ndash;&gt;-->
    <!--&lt;!&ndash;          layout="total, sizes, prev, pager, next, jumper"&ndash;&gt;-->
    <!--&lt;!&ndash;          @size-change="handleSizeChange2"&ndash;&gt;-->
    <!--&lt;!&ndash;          @current-change="handleCurrentChange2"/>&ndash;&gt;-->
    <!--&lt;!&ndash;      </div>&ndash;&gt;-->
    <!--</el-card>-->
    <!--<el-card>-->
    <!--<div style="font-size: 20px">未分配采购</div>-->
    <!--<el-tabs type="border-card" @tab-click="searchTable1();searchTable2()">-->
    <!--<el-tab-pane label="标准件和外购件">-->
    <!--<el-table :data="tableData3" size="mini" style="max-height: 320px" height="320px" border>-->
    <!--<el-table-column align="center" label="机床图号" min-width="100px">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.机床图号 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column align="center" label="组号" min-width="80px">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.组号 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column align="center" label="物料类别" min-width="100px">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.物料类别 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column align="center" label="物料品种" min-width="100px">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.物料品种 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column align="center" label="图号或型号" min-width="100px">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.物料型号 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column align="center" label="名称" min-width="100px">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.物料名称 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column align="center" label="规格" min-width="100px">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.物料规格 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column align="center" label="数量" min-width="80px">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.零件数量 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column align="center" label="备注" min-width="100px">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.备注 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column label="操作" width="200px" fixed="right" align="center">-->
    <!--<template slot-scope="scope">-->
    <!--<el-button-->
    <!--size="mini"-->
    <!--type="text"-->
    <!--@click="type=2;handleEdit(scope.row)"/>-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--</el-table>-->
    <!--&lt;!&ndash;          <div class="block">&ndash;&gt;-->
    <!--&lt;!&ndash;            <el-pagination&ndash;&gt;-->
    <!--&lt;!&ndash;              :current-page="pageCurrent3"&ndash;&gt;-->
    <!--&lt;!&ndash;              :page-sizes="[10, 20, 30, 40]"&ndash;&gt;-->
    <!--&lt;!&ndash;              :page-size="pageSize3"&ndash;&gt;-->
    <!--&lt;!&ndash;              :total="total3"&ndash;&gt;-->
    <!--&lt;!&ndash;              style="display:inline-block;width:50%"&ndash;&gt;-->
    <!--&lt;!&ndash;              layout="total, sizes, prev, pager, next, jumper"&ndash;&gt;-->
    <!--&lt;!&ndash;              @size-change="handleSizeChange3"&ndash;&gt;-->
    <!--&lt;!&ndash;              @current-change="handleCurrentChange3"/>&ndash;&gt;-->
    <!--&lt;!&ndash;          </div>&ndash;&gt;-->
    <!--</el-tab-pane>-->
    <!--<el-tab-pane label="基本件">-->
    <!--<el-table :data="tableData4" size="mini" style="max-height: 320px" height="320px" border>-->
    <!--<el-table-column align="center" label="机床图号" min-width="100px">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.机床图号 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column align="center" label="组号" min-width="80px">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.组号 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column align="center" label="图号" min-width="100px">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.零件图号 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column align="center" label="名称" min-width="100px">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.零件名称 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column align="center" label="规格" min-width="100px">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.规格 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column align="center" label="材料" min-width="100px">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.材料 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column align="center" label="数量" min-width="80px">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.数量 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column align="center" label="备注" min-width="100px">-->
    <!--<template slot-scope="scope">-->
    <!--{{ scope.row.备注 }}-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--<el-table-column label="操作" width="200px" fixed="right" align="center">-->
    <!--<template slot-scope="scope">-->
    <!--<el-button-->
    <!--size="mini"-->
    <!--type="text"-->
    <!--@click="type=2;handleEdit(scope.row)"/>-->
    <!--</template>-->
    <!--</el-table-column>-->
    <!--</el-table>-->
    <!--&lt;!&ndash;          <div class="block">&ndash;&gt;-->
    <!--&lt;!&ndash;            <el-pagination&ndash;&gt;-->
    <!--&lt;!&ndash;              :current-page="pageCurrent4"&ndash;&gt;-->
    <!--&lt;!&ndash;              :page-sizes="[10, 20, 30, 40]"&ndash;&gt;-->
    <!--&lt;!&ndash;              :page-size="pageSize4"&ndash;&gt;-->
    <!--&lt;!&ndash;              :total="total4"&ndash;&gt;-->
    <!--&lt;!&ndash;              style="display:inline-block;width:50%"&ndash;&gt;-->
    <!--&lt;!&ndash;              layout="total, sizes, prev, pager, next, jumper"&ndash;&gt;-->
    <!--&lt;!&ndash;              @size-change="handleSizeChange4"&ndash;&gt;-->
    <!--&lt;!&ndash;              @current-change="handleCurrentChange4"/>&ndash;&gt;-->
    <!--&lt;!&ndash;          </div>&ndash;&gt;-->
    <!--</el-tab-pane>-->
    <!--</el-tabs>-->
    <!--</el-card>-->
    <el-card>
      <div>
        <span style="font-size: 20px">临时表</span>
        <el-button style="float: right" type="danger" size="small" plain @click="alldelete5()">全部删除</el-button>
      </div>
      <el-tabs v-model="activeName" style="margin-top: 10px" type="border-card" @tab-click="searchTable5();searchTable6()">
        <el-tab-pane label="标准件和外购件" name="1">
          <el-table :data="tableData5" size="mini" style="max-height: 320px" height="320px" border>
            <el-table-column align="center" label="项目" min-width="100px">
              <template slot-scope="scope">
                {{ scope.row.项目 }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="机床" min-width="80px">
              <template slot-scope="scope">
                {{ scope.row.机床 }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="组号" min-width="100px">
              <template slot-scope="scope">
                {{ scope.row.组号 }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="物料名称" min-width="100px">
              <template slot-scope="scope">
                {{ scope.row.物料名称 }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="物料规格" min-width="100px">
              <template slot-scope="scope">
                {{ scope.row.物料规格 }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="物料型号" min-width="100px">
              <template slot-scope="scope">
                {{ scope.row.物料型号 }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="装机数量" min-width="100px">
              <template slot-scope="scope">
                {{ scope.row.装机数量 }}
              </template>
            </el-table-column>
            <el-table-column label="操作" width="200px" fixed="right" align="center">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="danger"
                  plain
                  @click="handleDelete5(scope.row)">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
          <!--          <div class="block">-->
          <!--            <el-pagination-->
          <!--              :current-page="pageCurrent5"-->
          <!--              :page-sizes="[10, 20, 30, 40]"-->
          <!--              :page-size="pageSize5"-->
          <!--              :total="total5"-->
          <!--              style="display:inline-block;width:50%"-->
          <!--              layout="total, sizes, prev, pager, next, jumper"-->
          <!--              @size-change="handleSizeChange5"-->
          <!--              @current-change="handleCurrentChange5"/>-->
          <!--          </div>-->
        </el-tab-pane>
        <el-tab-pane label="基本件" name="2">
          <el-table :data="tableData6" size="mini" style="max-height: 320px" height="320px" border>
            <el-table-column align="center" label="项目" min-width="100px">
              <template slot-scope="scope">
                {{ scope.row.项目 }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="机床" min-width="80px">
              <template slot-scope="scope">
                {{ scope.row.机床 }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="组号" min-width="100px">
              <template slot-scope="scope">
                {{ scope.row.组号 }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="图号或者型号" min-width="100px">
              <template slot-scope="scope">
                {{ scope.row.图号或者型号 }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="名称" min-width="100px">
              <template slot-scope="scope">
                {{ scope.row.名称 }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="材料或者规格" min-width="100px">
              <template slot-scope="scope">
                {{ scope.row.材料或者规格 }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="装机数量" min-width="100px">
              <template slot-scope="scope">
                {{ scope.row.装机数量 }}
              </template>
            </el-table-column>
            <el-table-column label="操作" width="200px" fixed="right" align="center">
              <template slot-scope="scope">
                <el-button
                  size="mini"
                  type="danger"
                  plain
                  @click="handleDelete6(scope.row)">删除</el-button>
              </template>
            </el-table-column>
          </el-table>
          <!--          <div class="block">-->
          <!--            <el-pagination-->
          <!--              :current-page="pageCurrent6"-->
          <!--              :page-sizes="[10, 20, 30, 40]"-->
          <!--              :page-size="pageSize6"-->
          <!--              :total="total6"-->
          <!--              style="display:inline-block;width:50%"-->
          <!--              layout="total, sizes, prev, pager, next, jumper"-->
          <!--              @size-change="handleSizeChange6"-->
          <!--              @current-change="handleCurrentChange6"/>-->
          <!--          </div>-->
        </el-tab-pane>
      </el-tabs>
    </el-card>
    <el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible3" title="更改数量" center style="min-height: 300px" width="350px">
      <el-form ref="form3" :model="form3" :rules="rules3" label-position="right" label-width="80px" class="demo-ruleForm">
        <el-form-item label="数量" prop="数量">
          <el-input
            :readonly="editnumber"
            v-model="form3.数量"
            size="small"
            style="width:200px"/>
        </el-form-item>
        <el-form-item v-if="showmessage" label="名称" prop="名称">
          <el-input
            v-model="form3.名称"
            size="small"
            style="width:200px"/>
        </el-form-item>
        <el-form-item v-if="showmessage" label="零件图号" prop="零件图号">
          <el-input
            v-model="form3.零件图号"
            size="small"
            style="width:200px"/>
        </el-form-item>
        <el-form-item v-if="showmessage" label="材料" prop="材料">
          <el-select v-model="form3.材料" placeholder="请选择材料" style="margin: 0px 20px 0px 0px" filterable clearable size="small">
            <el-option
              v-for="item in material"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitEdit('form3')">确定</el-button>
      </div>
    </el-dialog>

    <el-dialog v-el-drag-dialog :visible.sync="dialogFormVisible4" title="更改数量" center style="min-height: 300px" width="350px">
      <el-form ref="form4" :model="form4" :rules="rules4" label-position="right" label-width="80px" class="demo-ruleForm">
        <el-form-item label="部件数量" prop="数量">
          <el-input
            v-model="form4.数量"
            size="small"
            style="width:200px"/>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitEditNumber('form4')">确定</el-button>
      </div>
    </el-dialog>

    <el-dialog v-el-drag-dialog :visible.sync="dialogVisible3" title="物料变更选择" center style="min-height: 300px;" width="780px">
      <el-row style="margin-bottom: 10px">
        <span>物料名称：</span>
        <el-input v-model="materialName0" placeholder="物料名称" style="width: 200px" size="small" clearable/>
        <span>物料规格：</span>
        <el-input v-model="materialSpec0" placeholder="物料规格" style="width: 200px" size="small" clearable/>
      </el-row>
      <el-row style="margin-bottom: 10px">
        <span>物料型号：</span>
        <el-input v-model="materialModel0" placeholder="物料型号" style="width: 200px" size="small" clearable/>
        <el-button type="success" size="small" icon="el-icon-search" style="margin-left:10px" @click="pageCurrent02=1;pageSize02=10;total02=0;searchMaterial()">查询</el-button>
      </el-row>
      <el-table :data="tableData02" size="mini" style="width: 97%;max-height: 300px;margin-top:15px" height="400px" border highlight-current-row @row-click="selectNewMaterial">
        <el-table-column align="center" label="物料名称" min-width="150">
          <template slot-scope="scope">
            {{ scope.row.物料名称 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="物料规格" min-width="150">
          <template slot-scope="scope">
            {{ scope.row.物料规格 }}
          </template>
        </el-table-column>
        <el-table-column align="center" label="物料型号" min-width="150">
          <template slot-scope="scope">
            {{ scope.row.物料型号 }}
          </template>
        </el-table-column>
      </el-table>
      <div class="block" style="margin: 10px 0;">
        <el-pagination
          :current-page="pageCurrent02"
          :page-sizes="[10, 20, 30, 40]"
          :page-size="pageSize02"
          :total="total02"
          style="display:inline-block;width:50%"
          layout="total, sizes, prev, pager, next, jumper"
          @size-change="handleSizeChange02"
          @current-change="handleCurrentChange02"/>
      </div>
      <span style="font-size: large;color: red">将原物料替换为: {{ materialNew }}</span>
      <!--<el-input v-model="materialNew" size="small" readonly style="margin: 10px 10px 0 10px"></el-input>-->
      <div slot="footer" class="dialog-footer">
        <el-button size="small" @click="dialogVisible3=false">取消</el-button>
        <el-button type="primary" size="small" @click="submitMaterialChange">确定</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { materialChange, searchAllMaterial, getmaterial, alldeleteWB, alldelete, machineSelect, groupSelect, basicPartsData, deleteBasicParts, deleteBasicParts5, deleteBasicParts6, alldeleteBasicParts5, alldeleteBasicParts6, purchasePartsData, deletePurchaseData, editPurchaseData, editBasicParts, getTable, editProductNum, getTable1, editProduceNum, searchTable1, searchTable2, searchTable5, searchTable6, editGroupBasicPartNum, editGroupPartNum, editgroupNum, isExitBasicParts } from '@/api/BasicData/PartsNumberMaintenance'
export default {
  name: 'Index',
  data() {
    return {
      material: [],
      activeName: '1',
      projectName: '',
      BasicParts: '',
      PurchaseData: '',
      productNum: '',
      produceNum: '',
      partNumber: '',
      groupPartNum: '',
      groupBasicPartNum: '',
      type: '',
      machineValue: '',
      machineName: '',
      machine: [],
      groupValue: '',
      group: [],
      groupNumber: 0,
      form3: {
        数量: '',
        名称: '',
        零件图号: '',
        材料: ''
      },
      rules3: {
        数量: [{ required: true, message: '请输入数量', trigger: 'blur' }]
      },
      dialogFormVisible3: false,
      form4: {
        数量: ''
      },
      rules4: {
        数量: [{ required: true, message: '请输入数量', trigger: 'blur' }]
      },
      dialogFormVisible4: false,
      loading: false,
      loadingWB: false,
      editnumber: false,
      // total: 0,
      oldDrawingNumber: '',
      tableData: [],
      tableData1: [],
      tableData2: [],
      tableData3: [],
      tableData4: [],
      tableData5: [],
      tableData6: [],
      tableDataWB: [],
      BasicGroup: [],
      PurchaseGroup: [],
      // pageCurrent: 1,
      // pageSize: 10,
      // pageCurrent1: 1,
      // pageSize1: 10,
      // total1: 0,
      // pageCurrent2: 1,
      // pageSize2: 10,
      // total2: 0,
      // pageCurrent3: 1,
      // pageSize3: 10,
      // total3: 0,
      // pageCurrent4: 1,
      // pageSize4: 10,
      // total4: 0,
      // pageCurrent5: 1,
      // pageSize5: 10,
      // total5: 0,
      // pageCurrent6: 1,
      // pageSize6: 10,
      // total6: 0,
      pageCurrent7: 1,
      pageSize7: 10,
      total7: 0,
      gouxuan: 0,
      totalnumber: 0,
      showmessage: false,
      dialogVisible3: false,
      groupPartNumValue: '',
      standardAndPurchaseValue: '',
      materialOldValue: '',
      materialSpec0: '',
      materialName0: '',
      materialModel0: '',
      tableData02: [],
      pageCurrent02: 1,
      pageSize02: 20,
      total02: 0,
      materialNew: '',
      materialNewValue: ''

      // pageCurrentWB: 1,
      // pageSizeWB: 10,
      // totalWB: 0
    }
  },
  computed: {
    ...mapGetters([
      'name',
      'token',
      'id' // 人员编号
    ]),
    groupName() {
      for (let i = 0; i < this.group.length; i++) {
        if (this.group[i].value === this.groupValue) {
          return this.group[i].label
        }
      }
    }
  },
  watch: {
    machine(val) {
      if (val.length > 0) {
        this.machineValue = val[0].value
        for (let i = 0; i < this.machine.length; i++) {
          if (this.machine[i].value === val[0].value) {
            this.machineName = this.machine[i].label
          }
        }
      }
    },
    machineValue(val) {
      for (let i = 0; i < this.machine.length; i++) {
        if (val === this.machine[i].value) {
          this.machineName = this.machine[i].label
        }
      }
      console.log(val, 11, this.machineName)
      this.groupValue = ''
      this.group = []
      this.groupNumber = 0
      this.tableData = []
      this.tableDataWB = []
      this.tableData5 = []
      this.tableData6 = []
      if (val) {
        this.getGroupSelect(val)
      }
    },
    group(val) {
      if (val.length > 0) {
        this.groupValue = val[0].value
        this.groupNumber = val[0].number
      }
    },
    groupValue(val) {
      if (val) {
        this.pageCurrentWB = 1
        this.pageSizeWB = 10
        this.pageCurrent = 1
        this.pageSize = 10
        // console.log(this.projectName, this.machineName, this.groupName)
        this.getTableData()
        this.getTable()
        this.getTable1()
        this.searchTable1()
        this.searchTable2()
        this.searchTable5()
        this.searchTable6()
      }
    }
  },
  created() {
    this.getMaterial()
  },
  mounted() {
    this.fetchData()
  },
  methods: {
    selectable(row) {
      return row.考核状态 < 6 && row.状态 !== '已加工'
    },
    getNumber() {
      this.groupNumber = 0
      for (let i = 0; i < this.group.length; i++) {
        if (this.group[i].value === this.groupValue) {
          this.groupNumber = this.group[i].number
        }
      }
    },
    selectable1(row) {
      return row.询价状态编号 !== 3
    },
    submitMaterialChange() {
      materialChange(this.groupPartNumValue, this.standardAndPurchaseValue, this.materialOldValue, this.materialNewValue, this.id).then(response => {
        if (response.data[0].result === '1') {
          this.$message.success('提交变更申请成功')
          this.dialogVisible3 = false
          this.searchTable11()
        } else { this.$message.error('操作失败') }
      })
      this.getTableData()
    },
    searchMaterial() {
      if (this.materialName0 || this.materialSpec0 || this.materialModel0) {
        let check1, check2, check3
        this.materialName0 ? check1 = 1 : check1 = 0
        this.materialSpec0 ? check2 = 1 : check2 = 0
        this.materialModel0 ? check3 = 1 : check3 = 0
        searchAllMaterial(check1, this.materialName0, check2, this.materialSpec0, check3, this.materialModel0, this.pageCurrent02, this.pageSize02).then(response => {
          this.tableData02 = response.data.result
          this.total02 = parseInt(response.data.output[0].ItemCount)
        })
      } else {
        this.$message.warning('请至少输入一种搜索条件')
      }
    },
    selectNewMaterial(row) {
      this.materialNew = ''
      this.materialNewValue = row.物料流水号
      this.materialNew += row.物料名称 + ' ' + row.物料规格 + ' ' + row.物料型号
    },
    materialChange(row) { // 物料变更 标准件和外购件
      console.log(row.组件零件流水号, 12)
      if (row.组件零件流水号 !== '' && row.组件零件流水号 !== null) {
        this.$confirm('该物料已分配到采购部，是否继续修改?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.dialogVisible3 = true
          this.groupPartNumValue = row.组件零件流水号
          this.standardAndPurchaseValue = row.标准件和外购件流水号
          this.materialOldValue = row.物料流水号
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消修改'
          })
        })
      } else {
        this.dialogVisible3 = true
        this.groupPartNumValue = row.组件零件流水号
        this.standardAndPurchaseValue = row.标准件和外购件流水号
        this.materialOldValue = row.物料流水号
      }
    },
    getMaterial() {
      getmaterial().then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.material.push({
            value: response.data[i].材料流水号,
            label: response.data[i].材料
          })
        }
      })
    },
    fetchData() {
      this.getSelect(machineSelect, ['机床图号', '机床流水号'], 'machine')
      console.log(this.machine)
    },
    getGroupSelect(val) {
      this.group = []
      groupSelect(val).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.group.push({
            label: response.data[i].组号,
            value: response.data[i].组件流水号,
            number: response.data[i].数量
          })
        }
      })
    },
    alldelete5() {
      this.$confirm('此操作将永久删除所有数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        if (this.activeName === '1') {
          alldeleteBasicParts5(this.machineName, this.groupName).then(res => {
            console.log(res, 1)
            if (res.data[0].result === '1') {
              this.$message.success('删除成功')
              this.searchTable5()
              this.searchTable6()
            } else { this.$message.error('删除失败') }
          })
        } else if (this.activeName === '2') {
          alldeleteBasicParts6(this.machineName, this.groupName).then(res => {
            console.log(res, 2)
            if (res.data[0].result === '1') {
              this.$message.success('删除成功')
              this.searchTable5()
              this.searchTable6()
            } else { this.$message.error('删除失败') }
          })
        }
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        })
      })
    },
    handleSelectionChange(val) {
      this.gouxuan = val.length
      this.BasicGroup = []
      for (let i = 0; i < val.length; i++) {
        this.BasicGroup.push(val[i].基本件流水号)
      }
    },
    handleSelectionChange1(val) {
      this.PurchaseGroup = []
      for (let i = 0; i < val.length; i++) {
        this.PurchaseGroup.push(val[i].标准件和外购件流水号)
      }
    },
    alldelete() {
      this.$confirm('此操作将永久删除所有数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        alldelete(this.BasicGroup).then(res => {
          if (res.data[0].result === '1') {
            this.$message.success('删除成功')
            this.getTableData()
          } else { this.$message.error('删除失败') }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        })
      })
    },
    alldeleteWB() {
      this.$confirm('此操作将永久删除所有数据, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        alldeleteWB(this.PurchaseGroup).then(res => {
          if (res.data[0].result === '1') {
            this.$message.success('删除成功')
            this.getTableData()
          } else { this.$message.error('删除失败') }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消删除'
        })
      })
    },
    getTableData() {
      if (this.machineValue || this.groupValue || this.partNumber) {
        const machine_check = this.machineValue ? 1 : 0
        const group_check = this.groupValue ? 1 : 0
        const part_check = this.partNumber ? 1 : 0
        this.loading = true
        basicPartsData(machine_check, this.machineValue, group_check, this.groupValue, part_check, this.partNumber).then(response => {
          console.log(response, 111)
          this.loading = false
          const res = response.data
          this.totalnumber = response.data.length
          this.total = res.total
          this.tableData = res.map(item => {
            if (item.整改类型 === '1') {
              item.整改类型 = '新增'
            } else if (item.整改类型 === '2') {
              item.整改类型 = '替换'
            } else if (item.整改类型 === '3') {
              item.整改类型 = '补充加工'
            }
            return item
          })
        })
        this.loadingWB = true
        purchasePartsData(machine_check, this.machineValue, group_check, this.groupValue, part_check, this.partNumber).then(response => {
          this.loadingWB = false
          const data = response.data
          this.totalWB = data.total
          this.tableDataWB = data.map(item => {
            item.零件类型 = item.零件类型 === '2' ? '外购件' : '标准件'
            return item
          })
        })
      } else {
        this.$message.warning('至少选择一种条件')
      }
    },
    getTable() {
      this.tableData1 = []
      getTable(this.groupValue).then(response => {
        this.total1 = parseInt(response.data.total)
        this.tableData1 = []
        for (let i = 0; i < response.data.length; i++) {
          this.tableData1.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].材料流水号
          })
        }
      })
    },
    getTable1() {
      this.tableData2 = []
      this.checked_entryName = false
      if (this.machineValue === '') {
        this.checked_toolNum = false
      } else {
        this.checked_toolNum = true
      }
      if (this.groupValue === '') {
        this.checked_Num = false
      } else {
        this.checked_Num = true
      }
      if (this.partNumber !== '' && this.partNumber !== null) {
        this.checked_partNumber = true
      } else {
        this.checked_partNumber = false
      }
      getTable1(this.checked_entryName, '', this.checked_toolNum, this.machineValue, this.checked_Num, this.groupValue, this.checked_partNumber, this.partNumber).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          response.data[i].机加工开始时间_长日期 = response.data[i].机加工开始时间_长日期.substring(0, response.data[i].机加工开始时间_长日期.indexOf(' '))
          response.data[i].机加工结束时间_长日期 = response.data[i].机加工结束时间_长日期.substring(0, response.data[i].机加工结束时间_长日期.indexOf(' '))
        }
        this.total2 = parseInt(response.data.total)
        for (let i = 0; i < response.data.length; i++) {
          this.tableData2.push({
            零件图号: response.data[i].零件图号,
            零件名称: response.data[i].零件名称,
            投产数量: response.data[i].投产数量,
            机加工开始时间: response.data[i].机加工开始时间_长日期,
            机加工结束时间: response.data[i].机加工结束时间_长日期,
            工序数量: response.data[i].工序数量,
            工艺计划流水号: response.data[i].工艺计划流水号
          })
        }
      })
    },
    searchTable1() { // 查询标准件和外购件
      let check0, check1
      this.machineValue ? check0 = 1 : check0 = 0
      this.groupValue ? check1 = 1 : check1 = 0
      searchTable1(check0, this.machineValue, check1, this.groupValue).then(response => {
        this.tableData3 = response.data
        this.total3 = response.data.total
      })
    },
    searchTable2() { // 查询基本件
      let check0, check1
      this.machineValue ? check0 = 1 : check0 = 0
      this.groupValue ? check1 = 1 : check1 = 0
      searchTable2(check0, this.machineValue, check1, this.groupValue).then(response => {
        this.tableData4 = response.data
        this.total4 = response.data.total
      })
    },
    searchTable5() { // 查询标准件
      let check0, check1, check2
      this.machineName ? check0 = 1 : check0 = 0
      this.groupName ? check1 = 1 : check1 = 0
      this.partNumber ? check2 = 1 : check2 = 0
      searchTable5(check0, this.machineName, check1, this.groupName, check2, this.partNumber).then(response => {
        console.log(response, 5, this.activeName)
        this.tableData5 = response.data
        this.total5 = response.data.total
      })
    },
    searchTable6() { // 查询基本件
      let check0, check1, check2
      this.machineName ? check0 = 1 : check0 = 0
      this.groupName ? check1 = 1 : check1 = 0
      this.partNumber ? check2 = 1 : check2 = 0
      // console.log(this.projectName, this.machineName, this.groupName, 44)
      searchTable6(check0, this.machineName, check1, this.groupName, check2, this.partNumber).then(response => {
        console.log(response, 6)
        this.tableData6 = response.data
        this.total6 = response.data.total
      })
    },
    handleEdit(row) {
      this.BasicParts = ''
      this.PurchaseData = ''
      this.productNum = ''
      this.produceNum = ''
      if (this.$refs['form3'] !== undefined) {
        this.$refs['form3'].resetFields()
      }
      console.log(row.跟单号, row.考核状态, row.状态, row.材料流水号)
      if (row.基本件流水号 && this.type === 1 && row.跟单号 !== null) {
        this.$confirm('跟单已打出，是否确定修改?', '提示', {
          confirmButtonText: '确定',
          cancelButtonText: '取消',
          type: 'warning'
        }).then(() => {
          this.showmessage = true
          this.dialogFormVisible3 = true
          this.BasicParts = row.基本件流水号
          this.form3.数量 = row.零件数量
          this.form3.名称 = row.零件名称
          this.form3.零件图号 = row.零件图号
          this.oldDrawingNumber = row.零件图号
          this.form3.材料 = parseInt(row.材料流水号)
          console.log(this.form3.材料, 123)
          if (row.考核状态 >= 6 && row.状态 === '已加工') {
            this.editnumber = true
          } else {
            this.editnumber = false
          }
        }).catch(() => {
          this.$message({
            type: 'info',
            message: '已取消修改'
          })
        })
      } else if (row.基本件流水号 && this.type === 1 && row.跟单号 === null) {
        this.showmessage = true
        this.dialogFormVisible3 = true
        this.BasicParts = row.基本件流水号
        this.form3.数量 = row.零件数量
        this.form3.名称 = row.零件名称
        this.form3.零件图号 = row.零件图号
        this.oldDrawingNumber = row.零件图号
        this.form3.材料 = parseInt(row.材料流水号)
        if (row.考核状态 >= 6 && row.状态 === '已加工') {
          this.editnumber = true
        } else {
          this.editnumber = false
        }
      } else if (row.标准件和外购件流水号 && this.type === 1) {
        this.showmessage = false
        this.dialogFormVisible3 = true
        this.PurchaseData = row.标准件和外购件流水号
        this.form3.数量 = row.零件数量
      } else if (row.组件零件基本件流水号 && this.type === 1) {
        this.showmessage = false
        this.dialogFormVisible3 = true
        this.productNum = row.组件零件基本件流水号
        this.form3.数量 = row.投产总数量
      } else if (row.工艺计划流水号) {
        this.showmessage = false
        this.dialogFormVisible3 = true
        this.produceNum = row.工艺计划流水号
        this.form3.数量 = row.投产数量
      } else if (row.组件零件流水号 && this.type === 2) {
        this.showmessage = false
        this.dialogFormVisible3 = true
        this.groupPartNum = row.组件零件流水号
        this.form3.数量 = row.零件数量
      } else if (row.组件零件基本件流水号 && this.type === 2) {
        this.showmessage = false
        this.dialogFormVisible3 = true
        this.groupBasicPartNum = row.组件零件基本件流水号
        this.form3.数量 = row.数量
      }
    },
    submitEdit(formName) { // 提交单据编辑
      this.$refs[formName].validate((valid) => {
        if (valid) {
          if (this.BasicParts !== '') {
            if (this.oldDrawingNumber !== this.form3.零件图号) {
              isExitBasicParts(this.BasicParts, this.form3.零件图号).then(response => {
                console.log(response, 123324)
                if (Number(response.data[0].Column1) === 0) {
                  editBasicParts(this.BasicParts, this.form3.数量, this.form3.名称, this.form3.零件图号, this.form3.材料, this.id).then(response => {
                    if (response.data[0].result === '1') {
                      this.$message.success('编辑成功')
                      this.dialogFormVisible3 = false
                      this.getTableData()
                    } else { this.$message.error('编辑失败') }
                  })
                } else { this.$message.error('更改后的图号已存在') }
              })
            } else {
              editBasicParts(this.BasicParts, this.form3.数量, this.form3.名称, this.form3.零件图号, this.form3.材料, this.id).then(response => {
                if (response.data[0].result === '1') {
                  this.$message.success('编辑成功')
                  this.dialogFormVisible3 = false
                  this.getTableData()
                } else { this.$message.error('编辑失败') }
              })
            }
          } else if (this.PurchaseData !== '') {
            editPurchaseData(this.PurchaseData, this.form3.数量, this.id).then(response => {
              if (response.data[0].result === '1') {
                this.$message.success('编辑成功')
                this.dialogFormVisible3 = false
                this.getTableData()
              } else { this.$message.error('编辑失败') }
            })
          } else if (this.productNum !== '') {
            editProductNum(this.productNum, this.form3.数量).then(response => {
              if (response.data[0].result === '1') {
                this.$message.success('编辑成功')
                this.dialogFormVisible3 = false
                this.getTable()
              } else { this.$message.error('编辑失败') }
            })
          } else if (this.produceNum !== '') {
            editProduceNum(this.produceNum, this.form3.数量).then(response => {
              if (response.data[0].result === '1') {
                this.$message.success('编辑成功')
                this.dialogFormVisible3 = false
                this.getTable1()
              } else { this.$message.error('编辑失败') }
            })
          } else if (this.groupPartNum !== '') {
            editGroupPartNum(this.groupPartNum, this.form3.数量).then(response => {
              if (response.data[0].result === '1') {
                this.$message.success('编辑成功')
                this.dialogFormVisible3 = false
                this.searchTable1()
              } else { this.$message.error('编辑失败') }
            })
          } else if (this.groupBasicPartNum !== '') {
            editGroupBasicPartNum(this.groupBasicPartNum, this.form3.数量).then(response => {
              if (response.data[0].result === '1') {
                this.$message.success('编辑成功')
                this.dialogFormVisible3 = false
                this.searchTable2()
              } else { this.$message.error('编辑失败') }
            })
          }
        } else {
          console.log('error submit!!')
          return false
        }
      })
    },
    submitEditNumber(formName) {
      this.$refs[formName].validate((valid) => {
        if (valid) {
          editgroupNum(this.groupValue, this.form4.数量).then(response => {
            if (response.data[0].result === '1') {
              this.$message.success('编辑成功')
              this.groupNumber = this.form4.数量
              this.dialogFormVisible4 = false
              this.getTable()
              this.getTableData()
              this.getTable1()
            } else { this.$message.error('编辑失败') }
          })
        } else {
          console.log('error submit!!')
          return false
        }
      })
    },
    handleDelete(row) {
      if (row.基本件流水号) {
        this.deleteRow(deleteBasicParts, row.基本件流水号, function() {
          this.getTableData()
        })
      } else {
        this.deleteRow(deletePurchaseData, row.标准件和外购件流水号, function() {
          this.getTableData()
        })
      }
    },
    handleDelete5(row) {
      if (row.id) {
        this.deleteRow(deleteBasicParts5, row.id, function() {
          this.searchTable5()
          this.searchTable6()
        })
      }
    },
    handleDelete6(row) {
      if (row.id) {
        this.deleteRow(deleteBasicParts6, row.id, function() {
          this.searchTable5()
          this.searchTable6()
        })
      }
    },
    handleSizeChange02(val) {
      this.pageSize02 = val
      this.searchMaterial()
    },
    handleCurrentChange02(val) {
      this.pageCurrent02 = val
      this.searchMaterial()
    }
    // handleSizeChanges(val) {
    //   this.pageCurrent = 1
    //   this.pageSize = val
    //   this.getTableData()
    // },
    // handleCurrentChanges(val) {
    //   this.pageCurrent = val
    //   this.getTableData()
    // },
    // handleSizeChangeWB(val) {
    //   this.pageCurrentWB = 1
    //   this.pageSizeWB = val
    //   this.getTableData()
    // },
    // handleCurrentChangeWB(val) {
    //   this.pageCurrentWB = val
    //   this.getTableData()
    // },
    // handleSizeChange1(val) {
    //   this.pageCurrent1 = 1
    //   this.pageSize1 = val
    //   this.getTable()
    // },
    // handleCurrentChange1(val) {
    //   this.pageCurrent1 = val
    //   this.getTable()
    // },
    // handleSizeChange2(val) {
    //   this.pageSize2 = val
    //   this.pageCurrent2 = 1
    //   this.getTable1()
    // },
    // handleCurrentChange2(val) {
    //   this.pageCurrent2 = val
    //   this.getTable1()
    // },
    // handleSizeChange3(val) {
    //   this.pageSize3 = val
    //   this.pageCurrent3 = 1
    //   this.searchTable1()
    // },
    // handleCurrentChange3(val) {
    //   this.pageCurrent3 = val
    //   this.searchTable1()
    // },
    // handleSizeChange4(val) {
    //   this.pageSize4 = val
    //   this.pageCurrent4 = 1
    //   this.searchTable2()
    // },
    // handleCurrentChange4(val) {
    //   this.pageCurrent4 = val
    //   this.searchTable2()
    // },
    // handleSizeChange5(val) {
    //   this.pageSize5 = val
    //   this.pageCurrent5 = 1
    //   this.searchTable5()
    // },
    // handleCurrentChange5(val) {
    //   this.pageCurrent5 = val
    //   this.searchTable5()
    // },
    // handleSizeChange6(val) {
    //   this.pageSize6 = val
    //   this.pageCurrent6 = 1
    //   this.searchTable6()
    // },
    // handleCurrentChange6(val) {
    //   this.pageCurrent6 = val
    //   this.searchTable6()
    // },
  }
}
</script>

<style scoped>
  /*span{*/
  /*  margin: 20px;*/
  /*}*/
</style>
