<template>
  <div class="app-container">
    <el-tabs v-model="activeName" type="border-card" @tab-click="handleClick">
      <el-tab-pane label="基本件" name="first"><el-card>
        <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="searchBasciPartinfo()">基本件查询</el-button><br>
      </el-card>
        <el-card>
          <el-table
            v-loading="listLoading"
            :data="tableDataBasic"
            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="warning" icon="el-icon-tickets" style="margin: 0 0 0 0px" @click="searchBasicPartRecord(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>
          <el-table
            v-loading="listLoading1"
            :data="BasicPartIn"
            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="listLoading2"
            :data="BasicPartOut"
            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>
        </el-card>
      </el-tab-pane>
      <el-tab-pane label="通用件" name="second">
        <el-card>
          <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="total1 = 0;pageSize1 = 10;pageList1 = 1;searchGeneralPartinfo()">通用件查询</el-button><br>
        </el-card>
        <el-card>
          <el-table
            v-loading="listLoading3"
            :data="tableDataGeneral"
            :row-style="tableRowClassName2"
            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="warning" icon="el-icon-tickets" style="margin: 0 0 0 0px" @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>
          <el-table
            v-loading="listLoading4"
            :data="PurchasePartIn"
            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="listLoading5"
            :data="PurchasePartOut"
            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>
        </el-card>
      </el-tab-pane>
      <el-tab-pane label="外购件" name="third"><el-card>
        <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>
          <el-table
            v-loading="listLoading6"
            :data="tableDataPurchase"
            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="warning" icon="el-icon-tickets" style="margin: 0 0 0 0px" @click="searchPurchasePartRecord(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>
          <el-table
            v-loading="listLoading7"
            :data="PurchasePartIn"
            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="listLoading8"
            :data="PurchasePartOut"
            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>
        </el-card>
      </el-tab-pane>
      <el-tab-pane label="标准件" name="fourth">
        <el-card>
          <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>
          <el-table
            v-loading="listLoading9"
            :data="tableDataStandard"
            :row-style="tableRowClassName1"
            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" width="200px">
              <template slot-scope="scope" align="center">
                <el-button size="mini" type="warning" icon="el-icon-tickets" style="margin: 0 0 0 0px" @click="standardselecting(scope.row)" >选择</el-button>
                <el-button size="mini" type="primary" 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>
          <el-table
            v-loading="listLoading10"
            :data="StandardPartIn"
            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="StandardPartOut"
            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>
        </el-card>
      </el-tab-pane>
    </el-tabs>
  </div>
</template>

<script>
import { initProject, searchmachine, searchTeam, searchPurchasePart, searchBasicPart, searchStandardPart, searchGeneralPart, searchPurchasePartIn, searchPurchasePartOut, searchBasicPartIn, searchBasicPartOut, safeAmount, searchStandardPartIn, searchStandardPartOut } from '@/api/Inventory/InventoryCheck'
export default {
  data() {
    return {
      activeName: 'first',
      tableDataBasic: [], // 基本件
      BasicPartOut: [], // 基本件出库记录
      BasicPartIn: [], // 基本件入库记录,
      craftNumber: '',
      tableDataGeneral: [], // 通用件
      tableDataPurchase: [], // 外购件
      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: '',
      PageCurrent: 1,
      PageSize: 10,
      total: null,
      PageCurrent1: 1,
      PageSize1: 10,
      total1: null,
      PageCurrent2: 1,
      PageSize2: 10,
      total2: null,
      PageCurrent3: 1,
      PageSize3: 10,
      total3: null
    }
  },
  created() {
    this.fetchData()
  },
  methods: {
    handleClick(tab, event) {
    },
    fetchData() {
      this.getSelect(initProject, ['项目名称', '项目流水号'], 'Project') // 项目名称
    },
    searchMachine() { // 查询机床
      if (this.ProjectValue === ' ') {
        this.ProjectValue_check = 0
      }
      searchmachine(this.ProjectValue_check, 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() { // 查询组号
      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
      }
      if (this.MachineValue === ' ') {
        this.MachineValue_check = 0
      }
      if (this.GroupNumValue === ' ') {
        this.GroupNumValue_check = 0
      }
      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
      })
      this.projectValue = ' '
      this.MachineValue = ' '
      this.GroupNumValue = ' '
    },
    // 查询外购件记录
    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
      }
      if (this.MachineValue === ' ') {
        this.MachineValue_check = 0
      }
      if (this.GroupNumValue === ' ') {
        this.GroupNumValue_check = 0
      }
      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)
      })
      this.projectValue = ' '
      this.MachineValue = ' '
      this.GroupNumValue = ' '
    },
    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
      }
      if (this.MachineValue === ' ') {
        this.MachineValue_check = 0
      }
      if (this.GroupNumValue === ' ') {
        this.GroupNumValue_check = 0
      }
      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
      })
      this.projectValue = ' '
      this.MachineValue = ' '
      this.GroupNumValue = ' '
    },
    // 查询基本件
    searchBasciPartinfo() {
      this.listLoading = true
      this.tableDataBasic = []
      if (this.ProjectValue === ' ') {
        this.ProjectValue_check = 0
      }
      if (this.MachineValue === ' ') {
        this.MachineValue_check = 0
      }
      if (this.GroupNumValue === ' ') {
        this.GroupNumValue_check = 0
      }
      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.total = response.data.total
      })
      this.projectValue = ' '
      this.MachineValue = ' '
      this.GroupNumValue = ' '
    },
    // 查询基本件记录
    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.组件零件流水号
    },
    // 修改安全库存量
    edeitsafeAmount() {
      safeAmount(this.teamPartNumber, this.form.safeNumber).then(response => {
        this.dialogFormVisible2 = false
        if (response.data[0].result === '1') {
          this.$message.success('添加成功')
        } else {
          this.$message.error('添加失败')
        }
        this.form = {}
      })
    },
    // 重置表单
    callOff(formName) {
      this.form = {}
      this.dialogFormVisible2 = false
      this.$refs[formName].resetFields()
    },
    tableRowClassName1({ row }) {
      if (row.安全库存量 > 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()
    }
  }
}
</script>

<style scoped>

</style>
