<template>
  <div class="app-container">
    <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick" >
      <el-tab-pane label="自制" name="first"><el-card v-show="basicshow">
        <el-radio-group
          v-model="radio"
          size="small"
          style="margin: 10px;"
          @change="BasicShow()">
          <el-radio v-model="radio" :label="1" >基本件</el-radio>
          <el-radio v-model="radio" :label="2" style="margin-left: 2px" >通用件</el-radio>
        </el-radio-group>
        <span style="margin-left: 20px">项目名称:</span>
        <el-select v-model="ProjectValue" filterable clearable size="small" placeholder="请选择项目名称" style="width: 200px;margin-right:10px" @change="searchMachine()">
          <el-option
            v-for="item in Project"
            :key="item.value"
            :label="item.label"
            :value="item.value"/>
        </el-select>
        <span>机床图号:</span>
        <el-select v-model="MachineValue" filterable clearable size="small" placeholder="机床图号" style="width: 200px;margin-right:10px" @change="searchGroupList()">
          <el-option
            v-for="item in Machine"
            :key="item.value"
            :label="item.label"
            :value="item.value"/>
        </el-select>
        <span>组号:</span>
        <el-select v-model="GroupNumValue" filterable clearable size="small" placeholder="组号" style="width: 200px">
          <el-option
            v-for="item in GroupNum"
            :key="item.value"
            :label="item.label"
            :value="item.value"/>
        </el-select>
        <el-button size="small" type="success" icon="el-icon-search" style="margin: 0 0 0 10px" @click="searchBasciPartinfo()">基本件查询</el-button><br>
      </el-card>
        <el-card v-show="basicshow">
          <el-table
            v-loading="listLoading"
            :data="tableDataBasic"
            size="mini"
            border
            style="width: 100%;"
            height="200">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="项目名称" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.项目名称 }}
              </template>
            </el-table-column>
            <el-table-column label="机床图号" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.机床图号 }}
              </template>
            </el-table-column>
            <el-table-column label="组号" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.组号 }}
              </template>
            </el-table-column>
            <el-table-column label="零件名称" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.零件名称 }}
              </template>
            </el-table-column>
            <el-table-column label="零件数量" min-width="120" align="center">
              <template slot-scope="scope">
                {{ scope.row.可出库数量 }}
              </template>
            </el-table-column>
            <el-table-column label="零件类型" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.零件类型名称 }}
              </template>
            </el-table-column>
            <el-table-column label="操作" min-width="100" align="center">
              <template slot-scope="scope">
                <el-button
                  type="primary"
                  size="mini"
                  icon="el-icon-edit"
                  @click="AlterBasicNumber(scope.row)">设置</el-button>
              </template>
            </el-table-column>
          </el-table>
          <div class="block" style="margin-top: 10px;">
            <el-pagination
              :current-page="PageCurrent"
              :page-sizes="[10, 20, 30, 40]"
              :page-size="10"
              :total="total"
              layout="total, sizes, prev, pager, next, jumper"
              @size-change="handleSizeChange"
              @current-change="handleCurrentChange"/>
          </div>
        </el-card>
        <el-card v-show="basicshow">
          <el-table
            v-loading="listLoading1"
            :data="BasicPartIn"
            border
            size="mini"
            style="width: 100%;"
            height="200">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="入库数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.入库数量 }}
              </template>
            </el-table-column>
            <el-table-column label="入库人员" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.姓名 }}
              </template>
            </el-table-column>
            <el-table-column label="入库时间" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.入库时间 ? scope.row.入库时间.split(' ')[0] : '' }}
              </template>
            </el-table-column>
          </el-table>
          <el-table
            v-loading="listLoading2"
            v-show="basicshow"
            :data="BasicPartOut"
            border
            size="mini"
            style="width: 100%;"
            height="200">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="出库数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.出库数量 }}
              </template>
            </el-table-column>
            <el-table-column label="出库时间" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.出库日期 ? scope.row.出库日期.split(' ')[0] : '' }}
              </template>
            </el-table-column>
            <el-table-column label="领用者" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.姓名 }}
              </template>
            </el-table-column>
            <el-table-column label="出库备注" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.出库备注 }}
              </template>
            </el-table-column>
          </el-table>
        </el-card>
        <el-card v-show="genneralshow">
          <el-radio-group
            v-model="radio"
            size="mini"
            style="margin: 10px;"
            @change="BasicShow()">
            <el-radio v-model="radio" :label="1" >基本件</el-radio>
            <el-radio v-model="radio" :label="2" style="margin-left: 2px" >通用件</el-radio>
          </el-radio-group>
          <span style="margin-left: 20px">项目名称:</span>
          <el-select v-model="ProjectValue" filterable clearable size="small" placeholder="请选择项目名称" style="width: 200px;margin-right:10px" @change="searchMachine()">
            <el-option
              v-for="item in Project"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <span>机床图号:</span>
          <el-select v-model="MachineValue" filterable clearable size="small" placeholder="机床图号" style="width: 200px;margin-right:10px" @change="searchGroupList()">
            <el-option
              v-for="item in Machine"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <span>组号:</span>
          <el-select v-model="GroupNumValue" filterable clearable size="small" placeholder="组号" style="width: 200px">
            <el-option
              v-for="item in GroupNum"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <el-button size="small" type="success" icon="el-icon-search" style="margin: 0 0 0 10px" @click="total1 = 0;pageSize1 = 10;pageList1 = 1;searchGeneralPartinfo()">通用件查询</el-button><br>
        </el-card>
        <el-card v-show="genneralshow">
          <el-table
            v-loading="listLoading3"
            :data="tableDataGeneral"
            :row-style="tableRowClassName2"
            size="mini"
            border
            style="width: 100%;"
            height="200">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="项目名称" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.项目名称 }}
              </template>
            </el-table-column>
            <el-table-column label="机床图号" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.机床图号 }}
              </template>
            </el-table-column>
            <el-table-column label="组号" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.组号 }}
              </template>
            </el-table-column>
            <el-table-column label="零件名称" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.零件名称 }}
              </template>
            </el-table-column>
            <el-table-column label="零件数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.可出库数量 }}
              </template>
            </el-table-column>
            <el-table-column label="零件类型" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.零件类型名称 }}
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center" min-width="120">
              <template slot-scope="scope" align="center">
                <el-button size="small" type="primary" icon="el-icon-edit" style="margin: 0 0 0 0px" @row-click="searchGeneralPartRecord(scope.row)">设置</el-button>
              </template>
            </el-table-column>
          </el-table>
          <div class="block" style="margin-top: 10px;">
            <el-pagination
              :current-page="PageCurrent1"
              :page-sizes="[10, 20, 30, 40]"
              :page-size="10"
              :total="total1"
              layout="total, sizes, prev, pager, next, jumper"
              @size-change="handleSizeChange1"
              @current-change="handleCurrentChange1"/>
          </div>
        </el-card>
        <el-card v-show="genneralshow">
          <el-table
            v-loading="listLoading4"
            :data="PurchasePartIn"
            border
            size="mini"
            style="width: 100%;"
            height="200">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="实际到货数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.实际到货数量 }}
              </template>
            </el-table-column>
            <el-table-column label="入库人员" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.姓名 }}
              </template>
            </el-table-column>
            <el-table-column label="到货时间" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.到货时间 ? scope.row.到货时间.split(' ')[0] : '' }}
              </template>
            </el-table-column>
          </el-table>
          <el-table
            v-loading="listLoading5"
            v-show="genneralshow"
            :data="PurchasePartOut"
            size="mini"
            border
            style="width: 100%;"
            height="200">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="出库数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.出库数量 }}
              </template>
            </el-table-column>
            <el-table-column label="出库时间" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.出库时间 ? scope.row.出库时间.split(' ')[0] : '' }}
              </template>
            </el-table-column>
            <el-table-column label="领用者" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.领用者 }}
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-tab-pane>
      <!--编辑零件数量对话框-->
      <el-dialog :visible.sync="dialogFormVisible" title="盘点修改" center width="380px">
        <el-form ref="form2" :model="form2" :rules="rules2" label-position="left" class="demo-ruleForm">
          <el-form-item label="零件数量" prop="Number" label-width="100px" size="small">
            <el-input v-model="form2.Number" size="small" placeholder="出库数量" style="width: 200px"/>
          </el-form-item>
          <el-form-item label="修改原因" prop="AlterReason" label-width="100px">
            <el-input v-model="form2.AlterReason" size="small" placeholder="请输入备注" style="width: 200px"/>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="callOff2('form2')">取消</el-button>
          <el-button type="primary" @click="submitChannge()">确 定</el-button>
        </div>
      </el-dialog>
      <el-tab-pane label="采购" name="second">
        <el-card v-show="purchaseshow">
          <el-radio-group
            v-model="radio"
            size="mini"
            style="margin: 10px;"
            @change="GeneralShow()">
            <el-radio v-model="radio2" :label="3">外购件</el-radio>
            <el-radio v-model="radio2" :label="4" style="margin-left: 20px">标准件</el-radio>
            <el-radio v-model="radio2" :label="5" style="margin-left: 20px">基本件</el-radio>
          </el-radio-group>
          <span>项目名称:</span>
          <el-select v-model="ProjectValue" filterable clearable size="small" placeholder="请选择项目名称" style="width: 200px;margin-right:10px" @change="searchMachine()">
            <el-option
              v-for="item in Project"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <span>机床图号:</span>
          <el-select v-model="MachineValue" filterable clearable size="small" placeholder="机床图号" style="width: 200px;margin-right:10px" @change="searchGroupList()">
            <el-option
              v-for="item in Machine"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <span>组号:</span>
          <el-select v-model="GroupNumValue" filterable clearable size="small" placeholder="组号" style="width: 200px">
            <el-option
              v-for="item in GroupNum"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <el-button size="small" type="success" icon="el-icon-search" style="margin: 0 0 0 10px" @click="total2 = 0;pageSize2 = 10;pageList2 = 1;searchPurchasePartinfo()">外购件查询</el-button><br>
        </el-card>
        <el-card v-show="purchaseshow">
          <el-table
            v-loading="listLoading6"
            :data="tableDataPurchase"
            border
            size="mini"
            style="width: 100%;"
            height="200"
            @row-click="searchPurchasePartRecord">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="项目名称" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.项目名称 }}
              </template>
            </el-table-column>
            <el-table-column label="机床图号" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.机床图号 }}
              </template>
            </el-table-column>
            <el-table-column label="组号" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.组号 }}
              </template>
            </el-table-column>
            <el-table-column label="物料名称" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.物料名称 }}
              </template>
            </el-table-column>
            <el-table-column label="零件数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.货位存量 }}
              </template>
            </el-table-column>
            <el-table-column label="零件类型" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.类型名称 }}
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center" min-width="120">
              <template slot-scope="scope" align="center">
                <el-button size="small" type="warning" icon="el-icon-edit" style="margin: 0 0 0 0px" @click="AlterNumber(scope.row)">设置</el-button>
              </template>
            </el-table-column>
          </el-table>
          <div class="block" style="margin-top: 10px;">
            <el-pagination
              :current-page="PageCurrent2"
              :page-sizes="[10, 20, 30, 40]"
              :page-size="10"
              :total="total2"
              layout="total, sizes, prev, pager, next, jumper"
              @size-change="handleSizeChange2"
              @current-change="handleCurrentChange2"/>
          </div>
        </el-card>
        <el-card v-show="purchaseshow">
          <el-table
            v-loading="listLoading7"
            :data="PurchasePartIn"
            size="mini"
            border
            style="width: 100%;"
            height="200">
            <el-table-column
              label="序号"
              size="mini"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="实际到货数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.实际到货数量 }}
              </template>
            </el-table-column>
            <el-table-column label="入库人员" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.姓名 }}
              </template>
            </el-table-column>
            <el-table-column label="到货时间" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.到货时间 ? scope.row.到货时间.split(' ')[0] : '' }}
              </template>
            </el-table-column>
          </el-table>
          <el-table
            v-loading="listLoading8"
            :data="PurchasePartOut"
            border
            size="mini"
            style="width: 100%;"
            height="200">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="出库数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.出库数量 }}
              </template>
            </el-table-column>
            <el-table-column label="出库时间" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.出库时间 ? scope.row.出库时间.split(' ')[0] : '' }}
              </template>
            </el-table-column>
            <el-table-column label="领用者" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.领用者 }}
              </template>
            </el-table-column>
          </el-table>
        </el-card>
        <el-card v-show="standardshow">
          <el-radio-group
            v-model="radio"
            size="mini"
            style="margin: 10px;"
            @change="GeneralShow()">
            <el-radio v-model="radio2" :label="3">外购件</el-radio>
            <el-radio v-model="radio2" :label="4" style="margin-left: 20px">标准件</el-radio>
            <el-radio v-model="radio2" :label="5" style="margin-left: 20px">基本件</el-radio>
          </el-radio-group>
          <span>项目名称:</span>
          <el-select v-model="ProjectValue" filterable clearable size="small" placeholder="请选择项目名称" style="width: 200px;margin-right:10px" @change="searchMachine()">
            <el-option
              v-for="item in Project"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <span>机床图号:</span>
          <el-select v-model="MachineValue" filterable clearable size="small" placeholder="机床图号" style="width: 200px;margin-right:10px" @change="searchGroupList()">
            <el-option
              v-for="item in Machine"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <span>组号:</span>
          <el-select v-model="GroupNumValue" filterable clearable size="small" placeholder="组号" style="width: 200px">
            <el-option
              v-for="item in GroupNum"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <el-button size="small" type="success" icon="el-icon-search" style="margin: 0 0 0 10px" @click="total3 = 0;pageSize3 = 10;pageList3 = 1;searchStandardPartinfo()">标准件查询</el-button><br>
        </el-card>
        <el-card v-show="standardshow">
          <el-table
            v-loading="listLoading9"
            :data="tableDataStandard"
            :row-style="tableRowClassName1"
            size="mini"
            border
            style="width: 100%;"
            height="200"
            @row-click="standardselecting">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="项目名称" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.项目名称 }}
              </template>
            </el-table-column>
            <el-table-column label="机床图号" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.机床图号 }}
              </template>
            </el-table-column>
            <el-table-column label="组号" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.组号 }}
              </template>
            </el-table-column>
            <el-table-column label="物料名称" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.物料名称 }}
              </template>
            </el-table-column>
            <el-table-column label="库存数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.货位存量 }}
              </template>
            </el-table-column>
            <el-table-column label="零件类型" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.外购件类型 }}
              </template>
            </el-table-column>
            <el-table-column label="安全库存" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.安全库存量 }}
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center" width="200px">
              <template slot-scope="scope" align="center">
                <el-button size="mini" type="primary" icon="el-icon-edit" style="margin: 0 0 0 0px" @click="AlterNumber(scope.row)" >设置</el-button>
                <el-button size="mini" type="danger" icon="el-icon-sort-up" style="margin: 0 0 0 0px" @click="changesafeAmount(scope.row)">修改</el-button>
              </template>
            </el-table-column>
          </el-table>
          <div class="block" style="margin-top: 10px;">
            <el-pagination
              :current-page="PageCurrent3"
              :page-sizes="[10, 20, 30, 40]"
              :page-size="10"
              :total="total3"
              layout="total, sizes, prev, pager, next, jumper"
              @size-change="handleSizeChange3"
              @current-change="handleCurrentChange3"/>
          </div>
        </el-card>
        <!--安全库存量对话框-->
        <el-dialog :visible.sync="dialogFormVisible2" title="安全库存量修改" center width="380px">
          <el-form ref="form" :model="Project" :rules="rules" label-position="left">
            <el-form-item label="安全库存量" prop="TotalContractAmount" label-width="100px">
              <el-input v-model="form.safeNumber" size="small" placeholder="请输入安全库存量" style="width: 200px"/>
            </el-form-item>
          </el-form>
          <div slot="footer" class="dialog-footer">
            <el-button @click="callOff('form')">取消</el-button>
            <el-button type="primary" @click="edeitsafeAmount()">确 定</el-button>
          </div>
        </el-dialog>
        <el-card v-show="purchaseBasicShow">
          <el-radio-group
            v-model="radio"
            size="mini"
            style="margin: 10px;"
            @change="GeneralShow()">
            <el-radio v-model="radio2" :label="3">外购件</el-radio>
            <el-radio v-model="radio2" :label="4" style="margin-left: 20px">标准件</el-radio>
            <el-radio v-model="radio2" :label="7" style="margin-left: 20px">基本件</el-radio>
          </el-radio-group>
          <span>项目名称:</span>
          <el-select v-model="ProjectValue" filterable clearable size="small" placeholder="请选择项目名称" style="width: 200px;margin-right:10px" @change="searchMachine()">
            <el-option
              v-for="item in Project"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <span>机床图号:</span>
          <el-select v-model="MachineValue" filterable clearable size="small" placeholder="机床图号" style="width: 200px;margin-right:10px" @change="searchGroupList()">
            <el-option
              v-for="item in Machine"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <span>组号:</span>
          <el-select v-model="GroupNumValue" filterable clearable size="small" placeholder="组号" style="width: 200px">
            <el-option
              v-for="item in GroupNum"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <el-button size="small" type="success" icon="el-icon-search" style="margin: 0 0 0 10px" @click="total7 = 0;pageSize7 = 10;pageList7 = 1;searchPurchaseBasciinfo()">基本件查询</el-button><br>
        </el-card>
        <el-card v-show="purchaseBasicShow">
          <el-table
            v-loading="listLoading6"
            :data="tablePurchaseBasic"
            border
            size="mini"
            style="width: 100%;"
            height="200"
            @row-click="searchPurchasePartRecord">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="项目名称" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.基本件项目名称 }}
              </template>
            </el-table-column>
            <el-table-column label="机床图号" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.基本件机床图号 }}
              </template>
            </el-table-column>
            <el-table-column label="组号" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.基本件组号 }}
              </template>
            </el-table-column>
            <el-table-column label="零件名称" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.零件名称 }}
              </template>
            </el-table-column>
            <el-table-column label="零件数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.货位存量 }}
              </template>
            </el-table-column>
            <el-table-column label="零件类型" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.类型名称 }}
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center" min-width="120">
              <template slot-scope="scope" align="center">
                <el-button size="small" type="warning" icon="el-icon-edit" style="margin: 0 0 0 0px" @click="AlterNumber(scope.row)">设置</el-button>
              </template>
            </el-table-column>
          </el-table>
          <div class="block" style="margin-top: 10px;">
            <el-pagination
              :current-page="PageCurrent7"
              :page-sizes="[10, 20, 30, 40]"
              :page-size="10"
              :total="total7"
              layout="total, sizes, prev, pager, next, jumper"
              @size-change="handleSizeChange7"
              @current-change="handleCurrentChange7"/>
          </div>
        </el-card>
        <el-card v-show="purchaseBasicShow">
          <el-table
            v-loading="listLoading7"
            :data="PurchasePartIn"
            size="mini"
            border
            style="width: 100%;"
            height="200">
            <el-table-column
              label="序号"
              size="mini"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="实际到货数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.实际到货数量 }}
              </template>
            </el-table-column>
            <el-table-column label="入库人员" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.姓名 }}
              </template>
            </el-table-column>
            <el-table-column label="到货时间" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.到货时间 ? scope.row.到货时间.split(' ')[0] : '' }}
              </template>
            </el-table-column>
          </el-table>
          <el-table
            v-loading="listLoading8"
            :data="PurchasePartOut"
            border
            size="mini"
            style="width: 100%;"
            height="200">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="出库数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.出库数量 }}
              </template>
            </el-table-column>
            <el-table-column label="出库时间" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.出库时间 ? scope.row.出库时间.split(' ')[0] : '' }}
              </template>
            </el-table-column>
            <el-table-column label="领用者" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.领用者 }}
              </template>
            </el-table-column>
          </el-table>
        </el-card>
        <el-card v-show="standardshow">
          <el-table
            v-loading="listLoading10"
            :data="StandardPartIn"
            border
            size="mini"
            style="width: 100%;"
            height="200">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="实际到货数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.实际到货数量 }}
              </template>
            </el-table-column>
            <el-table-column label="入库人员" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.姓名 }}
              </template>
            </el-table-column>
            <el-table-column label="到货时间" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.到货时间 ? scope.row.到货时间.split(' ')[0] : '' }}
              </template>
            </el-table-column>
          </el-table>
          <el-table
            v-loading="listLoading11"
            :data="StandardPartOut"
            size="mini"
            border
            style="width: 100%;"
            height="200">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="出库数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.出库数量 }}
              </template>
            </el-table-column>
            <el-table-column label="出库时间" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.出库时间 ? scope.row.到货时间.split(' ')[0] : '' }}
              </template>
            </el-table-column>
            <el-table-column label="领用者" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.领用者 }}
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-tab-pane>
      <el-tab-pane label="车间采购" name="third">
        <el-card v-show="housebasicshow">
          <el-radio-group
            v-model="radio"
            size="small"
            style="margin: 10px;"
            @change="HouseShow()">
            <el-radio :label="5">基本件</el-radio>
            <el-radio :label="6" style="margin-left: 2px">外购件</el-radio>
          </el-radio-group>
          <span style="margin-left: 20px">项目名称:</span>
          <el-select v-model="ProjectValue" filterable clearable size="small" placeholder="请选择项目名称" style="width: 200px;margin-right:10px" @change="searchMachine()">
            <el-option
              v-for="item in Project"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <span>机床图号:</span>
          <el-select v-model="MachineValue" filterable clearable size="small" placeholder="机床图号" style="width: 200px;margin-right:10px" @change="searchGroupList()">
            <el-option
              v-for="item in Machine"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <span>组号:</span>
          <el-select v-model="GroupNumValue" filterable clearable size="small" placeholder="组号" style="width: 200px">
            <el-option
              v-for="item in GroupNum"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <el-button size="small" type="success" icon="el-icon-search" style="margin: 0 0 0 10px" @click="searchHouseBasci()">车间采购基本件查询</el-button><br>
        </el-card>
        <el-card v-show="housebasicshow">
          <el-table
            v-loading="listLoadingx1"
            :data="HouseDataBasic"
            border
            size="mini"
            style="width: 100%;"
            height="200"
            @row-click="HouseBasicRecord">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="零件名称" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.物料名称 }}
              </template>
            </el-table-column>
            <el-table-column label="零件图号" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.零件图号 }}
              </template>
            </el-table-column>
            <el-table-column label="项目名称" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.项目名称 }}
              </template>
            </el-table-column>
            <el-table-column label="机床图号" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.机床图号 }}
              </template>
            </el-table-column>
            <el-table-column label="组号" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.组号 }}
              </template>
            </el-table-column>
            <el-table-column label="零件数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.货位存量 }}
              </template>
            </el-table-column>
            <el-table-column label="零件类型" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.类型名称 }}
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center" min-width="80">
              <template slot-scope="scope" align="center">
                <el-button size="small" type="primary" icon="el-icon-edit" style="margin: 0 0 0 10px" @click="AlterNumber(scope.row)">设置</el-button>
              </template>
            </el-table-column>
          </el-table>
          <div class="block" style="margin-top: 10px;">
            <el-pagination
              :current-page="PageCurrent5"
              :page-sizes="[10, 20, 30, 40]"
              :page-size="10"
              :total="total5"
              layout="total, sizes, prev, pager, next, jumper"
              @size-change="handleSizeChange5"
              @current-change="handleCurrentChange5"/>
          </div>
        </el-card>
        <el-card v-show="housebasicshow">
          <el-table
            v-loading="listLoading10"
            :data="HouseDataBasicIn"
            size="mini"
            border
            style="width: 100%;"
            height="200">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="实际到货数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.实际到货数量 }}
              </template>
            </el-table-column>
            <el-table-column label="入库人员" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.姓名 }}
              </template>
            </el-table-column>
            <el-table-column label="到货时间" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.到货时间 ? scope.row.到货时间.split(' ')[0] : '' }}
              </template>
            </el-table-column>
          </el-table>
          <el-table
            v-loading="listLoading11"
            :data="HouseDataBasicOut"
            border
            size="mini"
            style="width: 100%;"
            height="200">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="出库数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.出库数量 }}
              </template>
            </el-table-column>
            <el-table-column label="出库时间" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.出库时间 ? scope.row.出库时间.split(' ')[0] : '' }}
              </template>
            </el-table-column>
            <el-table-column label="领用者" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.领用者 }}
              </template>
            </el-table-column>
          </el-table>
        </el-card>
        <el-card v-show="housepurchaseshow">
          <el-radio-group
            v-model="radio"
            size="small"
            style="margin: 10px;"
            @change="HouseShow()">
            <el-radio :label="5">基本件</el-radio>
            <el-radio :label="6" style="margin-left: 2px">外购件</el-radio>
          </el-radio-group>
          <span style="margin-left: 20px">项目名称:</span>
          <el-select v-model="ProjectValue" filterable clearable size="small" placeholder="请选择项目名称" style="width: 200px;margin-right:10px" @change="searchMachine()">
            <el-option
              v-for="item in Project"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <span>机床图号:</span>
          <el-select v-model="MachineValue" filterable clearable size="small" placeholder="机床图号" style="width: 200px;margin-right:10px" @change="searchGroupList()">
            <el-option
              v-for="item in Machine"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <span>组号:</span>
          <el-select v-model="GroupNumValue" filterable clearable size="small" placeholder="组号" style="width: 200px">
            <el-option
              v-for="item in GroupNum"
              :key="item.value"
              :label="item.label"
              :value="item.value"/>
          </el-select>
          <el-button size="small" type="success" icon="el-icon-search" style="margin: 0 0 0 10px" @click="searchHousePurchase()">车间采购外购件查询</el-button><br>
        </el-card>
        <el-card v-show="housepurchaseshow">
          <el-table
            v-loading="listLoadingx2"
            :data="HouseDataPurchase"
            border
            size="mini"
            style="width: 100%;"
            height="200"
            @row-click="HousePurchaseRecord">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="物料名称" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.物料名称 }}
              </template>
            </el-table-column>
            <el-table-column label="物料规格" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.物料规格 }}
              </template>
            </el-table-column>
            <el-table-column label="物料型号" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.物料型号 }}
              </template>
            </el-table-column>
            <el-table-column label="项目名称" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.项目名称 }}
              </template>
            </el-table-column>
            <el-table-column label="机床图号" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.机床图号 }}
              </template>
            </el-table-column>
            <el-table-column label="组号" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.组号 }}
              </template>
            </el-table-column>
            <el-table-column label="零件数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.货位存量 }}
              </template>
            </el-table-column>
            <el-table-column label="零件类型" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.类型名称 }}
              </template>
            </el-table-column>
            <el-table-column label="操作" align="center" min-width="80">
              <template slot-scope="scope" align="center">
                <el-button size="small" type="primary" icon="el-icon-edit" style="margin: 0 0 0 10px" @click="AlterNumber(scope.row)">设置</el-button>
              </template>
            </el-table-column>
          </el-table>
          <div class="block" style="margin-top: 10px;">
            <el-pagination
              :current-page="PageCurrent6"
              :page-sizes="[10, 20, 30, 40]"
              :page-size="10"
              :total="total6"
              layout="total, sizes, prev, pager, next, jumper"
              @size-change="handleSizeChange6"
              @current-change="handleCurrentChange6"/>
          </div>
        </el-card>
        <el-card v-show="housepurchaseshow">
          <el-table
            v-loading="listLoading10"
            :data="HouseDataPurchaseIn"
            border
            size="mini"
            style="width: 100%;"
            height="200">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="实际到货数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.实际到货数量 }}
              </template>
            </el-table-column>
            <el-table-column label="入库人员" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.姓名 }}
              </template>
            </el-table-column>
            <el-table-column label="到货时间" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.到货时间 ? scope.row.到货时间.split(' ')[0] : '' }}
              </template>
            </el-table-column>
          </el-table>
          <el-table
            v-loading="listLoading11"
            :data="HouseDataPurchaseOut"
            border
            size="mini"
            style="width: 100%;"
            height="200">
            <el-table-column
              label="序号"
              align="center"
              type="index"
              width="50"/>
            <el-table-column label="出库数量" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.出库数量 }}
              </template>
            </el-table-column>
            <el-table-column label="出库时间" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.出库时间 ? scope.row.出库时间.split(' ')[0] : '' }}
              </template>
            </el-table-column>
            <el-table-column label="领用者" align="center" min-width="80">
              <template slot-scope="scope">
                {{ scope.row.领用者 }}
              </template>
            </el-table-column>
          </el-table>
        </el-card>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import { initProject, searchmachine, searchTeam, searchPurchasePart, searchBasicPart, searchStandardPart, searchGeneralPart, searchPurchasePartIn, searchPurchasePartOut, searchBasicPartIn, searchBasicPartOut, safeAmount, searchStandardPartIn, searchStandardPartOut, searchHourseBasicPart, searchHoursePurchasePart, CheckAlter, searchPurchaseBasicPart } from '@/api/Inventory/InventoryCheck'
export default {
  data() {
    return {
      activeName: 'first',
      tableDataBasic: [], // 基本件
      BasicPartOut: [], // 基本件出库记录
      BasicPartIn: [], // 基本件入库记录,
      craftNumber: '',
      tableDataGeneral: [], // 通用件
      tableDataPurchase: [], // 外购件
      PurchasePart: true,
      PurchasePartOut: [], // 外购件出库记录
      PurchasePartIn: [], // 外购件入库记录
      tableDataStandard: [], // 标准件
      ProjectValue: '',
      Project: [],
      ProjectValue_check: 1,
      MachineValue: '',
      Machine: [],
      MachineValue_check: 1,
      GroupNumValue: '',
      GroupNumValue_check: 1,
      GroupNum: [],
      ContractDetailValue: '',
      TeamPartNumber: '',
      form: {
        safeNumber: ''
      },
      rules: { // 表单验证规则
        safeNumber: [{ required: true, message: '请输入安全库存量', trigger: 'blur' }]
      },
      dialogFormVisible2: false,
      StandardPartOut: [],
      StandardPartIn: [],
      GeneralPartIn: [],
      GeneralPartOut: [],
      listLoading: '',
      listLoading1: '',
      listLoading2: '',
      listLoading3: '',
      listLoading4: '',
      listLoading5: '',
      listLoading6: '',
      listLoading7: '',
      listLoading8: '',
      listLoading9: '',
      listLoading10: '',
      listLoading11: '',
      listLoadingx1: '',
      listLoadingx2: '',
      PageCurrent: 1,
      PageSize: 10,
      total: null,
      PageCurrent1: 1,
      PageSize1: 10,
      total1: null,
      PageCurrent2: 1,
      PageSize2: 10,
      total2: null,
      PageCurrent3: 1,
      PageSize3: 10,
      total3: null,
      PageCurrent5: 1,
      PageSize5: 10,
      total5: null,
      PageCurrent6: 1,
      PageSize6: 10,
      total6: null,
      PageCurrent7: 1,
      PageSize7: 10,
      total7: null,
      radio: 1,
      radio2: 1,
      radio3: 1,
      basicshow: true,
      genneralshow: false,
      purchaseshow: true,
      standardshow: false,
      housebasicshow: true,
      housepurchaseshow: false,
      purchaseBasicShow: false,
      HouseDataBasic: [],
      HouseDataBasicOut: [],
      HouseDataBasicIn: [],
      HouseDataPurchase: [],
      HouseDataPurchaseOut: [],
      HouseDataPurchaseIn: [],
      tablePurchaseBasic: [],
      rules2: { // 表单验证规则
        Number: [{ required: true, message: '请输入安全库存量', trigger: 'blur' }],
        AlterReason: [{ required: true, message: '请输入安全库存量', trigger: 'blur' }]
      },
      dialogFormVisible: false,
      form2: {
        AlterReason: '',
        Number: ''
      },
      project: '',
      machinenumber: '',
      partnumber: '',
      oldnumber: '',
      locate: '',
      contractdetail: '',
      craftnumber: '',
      receive: '',
      name: '', // 名称
      mode: '', // 规格
      picture: '', // 图号
      type: '', // 型号
      material: '' // 材料
    }
  },
  computed: {
    ...mapGetters([
      'id' // 人员编号
    ])
  },
  created() {
    this.fetchData()
  },
  methods: {
    handleClick(tab, event) {
    },
    BasicShow() {
      if (this.radio === 1) {
        this.basicshow = true
        this.genneralshow = false
      } else if (this.radio === 2) {
        this.basicshow = false
        this.genneralshow = true
      }
    },
    GeneralShow() {
      if (this.radio === 3) {
        this.purchaseBasicShow = false
        this.purchaseshow = true
        this.standardshow = false
      } else if (this.radio === 4) {
        this.purchaseBasicShow = false
        this.purchaseshow = false
        this.standardshow = true
      } else {
        this.purchaseBasicShow = true
        this.purchaseshow = false
        this.standardshow = false
      }
    },
    HouseShow() {
      if (this.radio === 5) {
        this.housebasicshow = true
        this.housepurchaseshow = false
      } else {
        this.housebasicshow = false
        this.housepurchaseshow = true
      }
    },
    fetchData() {
      this.getSelect(initProject, ['项目名称', '项目流水号'], 'Project') // 项目名称
    },
    searchMachine() { // 查询机床
      this.Machine = []
      this.GroupNum = []
      this.MachineValue = ''
      this.GroupNumValue = ''
      if (this.ProjectValue !== '') {
        searchmachine(1, this.ProjectValue).then(response => {
          for (let i = 0; i < response.data.length; i++) {
            this.Machine.push({
              label: response.data[i].机床图号,
              value: response.data[i].机床流水号
            })
          }
        })
      }
    },
    searchGroupList() { // 查询组号
      this.GroupNum = []
      this.GroupNumValue = ''
      searchTeam(this.MachineValue).then(response => {
        for (let i = 0; i < response.data.length; i++) {
          this.GroupNum.push({
            label: response.data[i].组号,
            value: response.data[i].组件流水号
          })
        }
      })
    },
    // 查询外购件
    searchPurchasePartinfo() {
      this.listLoading6 = true
      this.tableDataPurchase = []
      if (this.ProjectValue === '') {
        this.ProjectValue_check = 0
      } else {
        this.ProjectValue_check = 1
      }
      if (this.MachineValue === '') {
        this.MachineValue_check = 0
      } else {
        this.MachineValue_check = 1
      }
      if (this.GroupNumValue === '') {
        this.GroupNumValue_check = 0
      } else {
        this.GroupNumValue_check = 1
      }
      searchPurchasePart(this.PageCurrent2, this.PageSize2, this.ProjectValue_check, this.ProjectValue, this.MachineValue_check, this.MachineValue, this.GroupNumValue_check, this.GroupNumValue).then(response => {
        this.tableDataPurchase = response.data.rows
        this.total2 = response.data.total
        this.listLoading6 = false
      })
    },
    // 查询外购件记录
    searchPurchasePartRecord(row) {
      this.listLoading7 = true
      this.listLoading8 = true
      this.ContractDetailValue = row.采购合同明细流水号
      this.TeamPartNumber = row.组件零件流水号
      searchPurchasePartIn(this.ContractDetailValue).then(response => {
        this.PurchasePartIn = response.data
        this.listLoading7 = false
      })
      searchPurchasePartOut(this.TeamPartNumber).then(response => {
        this.PurchasePartOut = response.data
        this.listLoading8 = false
      })
    },
    // 查询标准件
    searchStandardPartinfo() {
      this.listLoading9 = true
      this.tableDataStandard = []
      if (this.ProjectValue === '') {
        this.ProjectValue_check = 0
      } else {
        this.ProjectValue_check = 1
      }
      if (this.MachineValue === '') {
        this.MachineValue_check = 0
      } else {
        this.MachineValue_check = 1
      }
      if (this.GroupNumValue === '') {
        this.GroupNumValue_check = 0
      } else {
        this.GroupNumValue_check = 1
      }
      searchStandardPart(this.PageCurrent3, this.PageSize3, this.ProjectValue_check, this.ProjectValue, this.MachineValue_check, this.MachineValue, this.GroupNumValue_check, this.GroupNumValue).then(response => {
        this.tableDataStandard = response.data.rows
        this.total3 = response.data.total
        this.listLoading9 = false
        console.log(this.tableDataPurchase)
      })
    },
    standardselecting(row) {
      this.contractDeatilNumber = row.采购合同明细流水号
      this.steamPartNumber = row.组件零件流水号
      this.getStandardPartIn()
      this.getStandardPartOut()
    },
    // 查询标准件入库记录
    getStandardPartIn() {
      this.listLoading10 = true
      searchStandardPartIn(this.contractDeatilNumber).then(response => {
        this.StandardPartIn = response.data
        this.listLoading10 = false
      })
    },
    // 查询标准件出库记录
    getStandardPartOut() {
      this.listLoading11 = true
      searchStandardPartOut(this.steamPartNumber).then(response => {
        this.StandardPartOut = response.data
        this.listLoading11 = false
      })
    },
    // 查询通用件
    searchGeneralPartinfo() {
      this.listLoading3 = true
      this.tableDataGeneral = []
      if (this.ProjectValue === '') {
        this.ProjectValue_check = 0
      } else {
        this.ProjectValue_check = 1
      }
      if (this.MachineValue === '') {
        this.MachineValue_check = 0
      } else {
        this.MachineValue_check = 1
      }
      if (this.GroupNumValue === '') {
        this.GroupNumValue_check = 0
      } else {
        this.GroupNumValue_check = 1
      }
      searchGeneralPart(this.PageCurrent1, this.PageSize1, this.ProjectValue_check, this.ProjectValue, this.MachineValue_check, this.MachineValue, this.GroupNumValue_check, this.GroupNumValue).then(response => {
        this.tableDataGeneral = response.data.rows
        this.total1 = response.data.total
        this.listLoading3 = false
      })
    },
    // 查询外购基本件
    searchPurchaseBasciinfo() {
      this.listLoading = true
      this.tablePurchaseBasic = []
      if (this.ProjectValue === '') {
        this.ProjectValue_check = 0
      } else {
        this.ProjectValue_check = 1
      }
      if (this.MachineValue === '') {
        this.MachineValue_check = 0
      } else {
        this.MachineValue_check = 1
      }
      if (this.GroupNumValue === '') {
        this.GroupNumValue_check = 0
      } else {
        this.GroupNumValue_check = 1
      }
      searchPurchaseBasicPart(this.PageCurrent7, this.PageSize7, this.ProjectValue_check, this.ProjectValue, this.MachineValue_check, this.MachineValue, this.GroupNumValue_check, this.GroupNumValue).then(response => {
        this.tablePurchaseBasic = response.data.rows
        this.listLoading = false
        this.total7 = response.data.total
      })
    },
    // 查询基本件
    searchBasciPartinfo() {
      this.listLoading = true
      this.tableDataBasic = []
      if (this.ProjectValue === '') {
        this.ProjectValue_check = 0
      } else {
        this.ProjectValue_check = 1
      }
      if (this.MachineValue === '') {
        this.MachineValue_check = 0
      } else {
        this.MachineValue_check = 1
      }
      if (this.GroupNumValue === '') {
        this.GroupNumValue_check = 0
      } else {
        this.GroupNumValue_check = 1
      }
      searchBasicPart(this.PageCurrent, this.PageSize, this.ProjectValue_check, this.ProjectValue, this.MachineValue_check, this.MachineValue, this.GroupNumValue_check, this.GroupNumValue).then(response => {
        this.tableDataBasic = response.data.rows
        this.listLoading = false
        this.tableDataBasic.map(v => {
          this.$set(v, 'changeSafeValue', false)
          v.可出库数量 = v.可出库数量
          return v
        })
        this.total = response.data.total
      })
    },
    // 查询基本件记录
    searchBasicPartRecord(row) {
      this.craftNumber = row.工艺计划流水号
      this.listLoading1 = true
      this.listLoading2 = true
      searchBasicPartIn(this.craftNumber).then(response => {
        this.listLoading1 = false
        this.BasicPartIn = response.data
      })
      searchBasicPartOut(this.craftNumber).then(response => {
        this.listLoading2 = false
        this.BasicPartOut = response.data
      })
    },
    // 查询通用件记录
    searchGeneralPartRecord(row) {
      this.listLoading4 = true
      this.listLoading5 = true
      this.craftNumber = row.工艺计划流水号
      searchBasicPartIn(this.craftNumber).then(response => {
        this.GeneralPartIn = response.data
        this.listLoading4 = false
      })
      searchBasicPartOut(this.craftNumber).then(response => {
        this.GeneralPartOut = response.data
        this.listLoading5 = false
      })
    },
    changesafeAmount(row) {
      this.dialogFormVisible2 = true
      this.teamPartNumber = row.组件零件流水号
      this.form.safeNumber = row.安全库存量
    },
    // 修改安全库存量
    edeitsafeAmount() {
      safeAmount(this.teamPartNumber, this.form.safeNumber).then(response => {
        this.dialogFormVisible2 = false
        if (response.data[0].result === '1') {
          this.$message.success('添加成功')
          this.searchStandardPartinfo()
        } else {
          this.$message.error('添加失败')
        }
        this.form = {}
      })
    },
    // 重置表单
    callOff(formName) {
      this.form = {}
      this.dialogFormVisible2 = false
      this.$refs[formName].resetFields()
    },
    tableRowClassName1({ row }) {
      if (Number(row.安全库存量) > Number(row.货位存量)) {
        return 'background: #ff6666'
      } else {
        return ''
      }
    },
    tableRowClassName2({ row }) {
      const a = 0
      if (a >= row.可出库数量) {
        return 'background: #ff6666'
      } else {
        return ''
      }
    },
    handleSizeChange(val) {
      this.PageCurrent = 1
      this.PageSize = val
      this.searchPartinfo()
    },
    handleCurrentChange(val) {
      this.PageCurrent = val
      this.searchPartinfo()
    },
    handleSizeChange1(val) {
      this.PageCurrent1 = 1
      this.PageSize1 = val
      this.searchPartinfo()
    },
    handleCurrentChange1(val) {
      this.PageCurrent1 = val
      this.searchPartinfo()
    },
    handleSizeChange2(val) {
      this.PageCurrent2 = 1
      this.PageSize2 = val
      this.searchPartinfo()
    },
    handleCurrentChange2(val) {
      this.PageCurrent2 = val
      this.searchPartinfo()
    },
    handleSizeChange3(val) {
      this.PageCurrent3 = 1
      this.PageSize3 = val
      this.searchPartinfo()
    },
    handleCurrentChange3(val) {
      this.PageCurrent3 = val
      this.searchPartinfo()
    },
    handleSizeChange5(val) {
      this.PageCurrent5 = 1
      this.PageSize5 = val
      this.searchHouseBasci()
    },
    handleCurrentChange5(val) {
      this.PageCurrent5 = val
      this.searchHouseBasci()
    },
    handleSizeChange6(val) {
      this.PageCurrent6 = 1
      this.PageSize6 = val
      this.searchHousePurchase()
    },
    handleCurrentChange6(val) {
      this.PageCurrent6 = val
      this.searchHousePurchase()
    },
    handleSizeChange7(val) {
      this.PageCurrent7 = 1
      this.PageSize7 = val
      this.searchPurchaseBasciinfo()
    },
    handleCurrentChange7(val) {
      this.PageCurrent7 = val
      this.searchPurchaseBasciinfo()
    },
    // 查询车间采购基本件
    searchHouseBasci() {
      this.listLoadingx1 = true
      this.HouseDataBasic = []
      if (this.ProjectValue === '') {
        this.ProjectValue_check = 0
      } else {
        this.ProjectValue_check = 1
      }
      if (this.MachineValue === '') {
        this.MachineValue_check = 0
      } else {
        this.MachineValue_check = 1
      }
      if (this.GroupNumValue === '') {
        this.GroupNumValue_check = 0
      } else {
        this.GroupNumValue_check = 1
      }
      searchHourseBasicPart(this.PageCurrent5, this.PageSize5, this.ProjectValue_check, this.ProjectValue, this.MachineValue_check, this.MachineValue, this.GroupNumValue_check, this.GroupNumValue).then(response => {
        this.HouseDataBasic = response.data.rows
        this.listLoadingx1 = false
        this.total5 = response.data.total
      })
    },
    // 查询外购件记录
    HouseBasicRecord(row) {
      this.ContractDetailValue = row.采购合同明细流水号
      this.TeamPartNumber = row.组件零件流水号
      searchPurchasePartIn(this.ContractDetailValue).then(response => {
        this.HouseDataBasicIn = response.data
        this.listLoading7 = false
      })
      searchPurchasePartOut(this.TeamPartNumber).then(response => {
        this.HouseDataBasicOut = response.data
        this.listLoading8 = false
      })
    },
    // 查询车间采购外购件
    searchHousePurchase() {
      this.listLoadingx2 = true
      this.HouseDataPurchase = []
      if (this.ProjectValue === '') {
        this.ProjectValue_check = 0
      } else {
        this.ProjectValue_check = 1
      }
      if (this.MachineValue === '') {
        this.MachineValue_check = 0
      } else {
        this.MachineValue_check = 1
      }
      if (this.GroupNumValue === '') {
        this.GroupNumValue_check = 0
      } else {
        this.GroupNumValue_check = 1
      }
      searchHoursePurchasePart(this.PageCurrent6, this.PageSize6, this.ProjectValue_check, this.ProjectValue, this.MachineValue_check, this.MachineValue, this.GroupNumValue_check, this.GroupNumValue).then(response => {
        this.HouseDataPurchase = response.data.rows
        this.listLoadingx2 = false
        this.total6 = response.data.total
      })
    },
    // 查询外购件记录
    HousePurchaseRecord(row) {
      this.ContractDetailValue = row.采购合同明细流水号
      this.TeamPartNumber = row.组件零件流水号
      searchPurchasePartIn(this.ContractDetailValue).then(response => {
        this.HouseDataPurchaseIn = response.data
        this.listLoading7 = false
      })
      searchPurchasePartOut(this.TeamPartNumber).then(response => {
        this.HouseDataPurchaseOut = response.data
        this.listLoading8 = false
      })
    },
    AlterNumber(row) {
      this.project = row.项目流水号
      this.machinenumber = row.机床流水号
      this.partnumber = row.组件流水号
      this.oldnumber = row.货位存量
      this.locate = row.货位流水号
      this.contractdetail = row.采购合同明细流水号
      this.craftnumber = row.工艺计划流水号
      this.receive = row.收件信息id
      this.materiallocate = row.物料与货位对照流水号
      this.materialType = row.零件类型代码
      this.dialogFormVisible = true
      this.name = row.物料名称
      this.mode = row.物料规格
      this.picture = row.零件图号
      this.type = row.物料型号
      this.material = row.材料
    },
    AlterBasicNumber(row) {
      console.log(row, 556677)
      this.project = row.项目流水号
      this.machinenumber = row.机床流水号
      this.partnumber = row.组件流水号
      this.oldnumber = row.可出库数量
      this.locate = row.货位流水号
      this.contractdetail = row.采购合同明细流水号
      this.craftnumber = row.工艺计划流水号
      this.receive = row.收件信息id
      this.materiallocate = row.物料与货位对照流水号
      this.materialType = row.零件类型
      this.dialogFormVisible = true
      this.name = row.零件名称
      this.mode = row.物料规格
      this.picture = row.零件图号
      this.type = row.物料型号
      this.material = row.材料
    },
    submitChannge() {
      CheckAlter(this.receive, this.project, this.machinenumber, this.partnumber, this.oldnumber, this.form2.AlterReason, this.form2.Number, this.id, this.locate, this.contractdetail, this.craftnumber, this.materialType, this.materiallocate, this.name, this.mode, this.picture, this.type, this.material).then(response => {
        if (response.data[0].result === '1') {
          this.$message.success('修改成功')
          this.dialogFormVisible = false
          this.searchBasciPartinfo()
        } else {
          this.$message.error('修改失败')
        }
      })
    },
    callOff2() {
      this.dialogFormVisible = false
      this.form2 = {}
    }
  }
}
</script>

<style scoped>

</style>
