<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
      <el-form-item label="任务编号;移库时必须" prop="taskCode">
        <el-input
          v-model="queryParams.taskCode"
          placeholder="请输入任务编号;移库时必须"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="仓库ID;领料时需要保存" prop="warehouseId">
        <el-input
          v-model="queryParams.warehouseId"
          placeholder="请输入仓库ID;领料时需要保存"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="库位编码;移库和合库时需要保存" prop="locationCode">
        <el-input
          v-model="queryParams.locationCode"
          placeholder="请输入库位编码;移库和合库时需要保存"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="工单ID,关联pd_base_order_info的order_id" prop="orderId">
        <el-input
          v-model="queryParams.orderId"
          placeholder="请输入工单ID,关联pd_base_order_info的order_id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="计划ID,关联pd_base_plan_info的plan_id" prop="planId">
        <el-input
          v-model="queryParams.planId"
          placeholder="请输入计划ID,关联pd_base_plan_info的plan_id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="计划明细ID,关联pd_base_plan_detail的plan_detail_id" prop="planDetailId">
        <el-input
          v-model="queryParams.planDetailId"
          placeholder="请输入计划明细ID,关联pd_base_plan_detail的plan_detail_id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="所属工位，关联pd_base_station_info的station_id" prop="stationId">
        <el-input
          v-model="queryParams.stationId"
          placeholder="请输入所属工位，关联pd_base_station_info的station_id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="成品ID,关联物料表物料id" prop="productId">
        <el-input
          v-model="queryParams.productId"
          placeholder="请输入成品ID,关联物料表物料id"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="申请人" prop="applyBy">
        <el-input
          v-model="queryParams.applyBy"
          placeholder="请输入申请人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="申请时间" prop="applyDate">
        <el-date-picker clearable
          v-model="queryParams.applyDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择申请时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="审核人" prop="auditBy">
        <el-input
          v-model="queryParams.auditBy"
          placeholder="请输入审核人"
          clearable
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="审核时间" prop="auditDate">
        <el-date-picker clearable
          v-model="queryParams.auditDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择审核时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="最后更新时间" prop="updateDate">
        <el-date-picker clearable
          v-model="queryParams.updateDate"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择最后更新时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="执行开始时间" prop="beginTime">
        <el-date-picker clearable
          v-model="queryParams.beginTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择执行开始时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item label="执行结束时间" prop="endTime">
        <el-date-picker clearable
          v-model="queryParams.endTime"
          type="date"
          value-format="yyyy-MM-dd"
          placeholder="请选择执行结束时间">
        </el-date-picker>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-row :gutter="10" class="mb8">
      <el-col :span="1.5">
        <el-button
          type="primary"
          plain
          icon="el-icon-plus"
          size="mini"
          @click="handleAdd"
          v-hasPermi="['wms:rawoutstock:add']"
        >新增</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="success"
          plain
          icon="el-icon-edit"
          size="mini"
          :disabled="single"
          @click="handleUpdate"
          v-hasPermi="['wms:rawoutstock:edit']"
        >修改</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="danger"
          plain
          icon="el-icon-delete"
          size="mini"
          :disabled="multiple"
          @click="handleDelete"
          v-hasPermi="['wms:rawoutstock:remove']"
        >删除</el-button>
      </el-col>
      <el-col :span="1.5">
        <el-button
          type="warning"
          plain
          icon="el-icon-download"
          size="mini"
          @click="handleExport"
          v-hasPermi="['wms:rawoutstock:export']"
        >导出</el-button>
      </el-col>
      <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="rawoutstockList" @selection-change="handleSelectionChange">
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column label="原材料出库记录ID" align="center" prop="rawOutstockId" />
      <el-table-column label="任务编号;移库时必须" align="center" prop="taskCode" />
      <el-table-column label="仓库ID;领料时需要保存" align="center" prop="warehouseId" />
      <el-table-column label="库位编码;移库和合库时需要保存" align="center" prop="locationCode" />
      <el-table-column label="工单ID,关联pd_base_order_info的order_id" align="center" prop="orderId" />
      <el-table-column label="计划ID,关联pd_base_plan_info的plan_id" align="center" prop="planId" />
      <el-table-column label="计划明细ID,关联pd_base_plan_detail的plan_detail_id" align="center" prop="planDetailId" />
      <el-table-column label="所属工位，关联pd_base_station_info的station_id" align="center" prop="stationId" />
      <el-table-column label="成品ID,关联物料表物料id" align="center" prop="productId" />
      <el-table-column label="操作类型(0自动,1手动,2强制,3调度)" align="center" prop="operationType" />
      <el-table-column label="任务类型(1生产领料,2移库出库,3合库出库,9其他领料)" align="center" prop="taskType" />
      <el-table-column label="申请原因" align="center" prop="applyReason" />
      <el-table-column label="审核原因" align="center" prop="auditReason" />
      <el-table-column label="审核状态(0待审核,1审核通过,2审核未通过)" align="center" prop="auditStatus" />
      <el-table-column label="执行状态(0待执行,1执行中,2执行完成)" align="center" prop="executeStatus" />
      <el-table-column label="申请人" align="center" prop="applyBy" />
      <el-table-column label="申请时间" align="center" prop="applyDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.applyDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="审核人" align="center" prop="auditBy" />
      <el-table-column label="审核时间" align="center" prop="auditDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.auditDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="最后更新时间" align="center" prop="updateDate" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.updateDate, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="执行开始时间" align="center" prop="beginTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.beginTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="执行结束时间" align="center" prop="endTime" width="180">
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.endTime, '{y}-{m}-{d}') }}</span>
        </template>
      </el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['wms:rawoutstock:edit']"
          >明细</el-button>

          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['wms:rawoutstock:edit']"
          >修改</el-button>
          <el-button
            size="mini"
            type="text"
            icon="el-icon-delete"
            @click="handleDelete(scope.row)"
            v-hasPermi="['wms:rawoutstock:remove']"
          >删除</el-button>
        </template>
      </el-table-column>
    </el-table>

    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />

    <!-- 添加或修改原材料出库记录对话框 -->
    <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="80px">
        <el-form-item label="任务编号;移库时必须" prop="taskCode">
          <el-input v-model="form.taskCode" placeholder="请输入任务编号;移库时必须" />
        </el-form-item>
        <el-form-item label="仓库ID;领料时需要保存" prop="warehouseId">
          <el-input v-model="form.warehouseId" placeholder="请输入仓库ID;领料时需要保存" />
        </el-form-item>
        <el-form-item label="库位编码;移库和合库时需要保存" prop="locationCode">
          <el-input v-model="form.locationCode" placeholder="请输入库位编码;移库和合库时需要保存" />
        </el-form-item>
        <el-form-item label="工单ID,关联pd_base_order_info的order_id" prop="orderId">
          <el-input v-model="form.orderId" placeholder="请输入工单ID,关联pd_base_order_info的order_id" />
        </el-form-item>
        <el-form-item label="计划ID,关联pd_base_plan_info的plan_id" prop="planId">
          <el-input v-model="form.planId" placeholder="请输入计划ID,关联pd_base_plan_info的plan_id" />
        </el-form-item>
        <el-form-item label="计划明细ID,关联pd_base_plan_detail的plan_detail_id" prop="planDetailId">
          <el-input v-model="form.planDetailId" placeholder="请输入计划明细ID,关联pd_base_plan_detail的plan_detail_id" />
        </el-form-item>
        <el-form-item label="所属工位，关联pd_base_station_info的station_id" prop="stationId">
          <el-input v-model="form.stationId" placeholder="请输入所属工位，关联pd_base_station_info的station_id" />
        </el-form-item>
        <el-form-item label="成品ID,关联物料表物料id" prop="productId">
          <el-input v-model="form.productId" placeholder="请输入成品ID,关联物料表物料id" />
        </el-form-item>
        <el-form-item label="申请原因" prop="applyReason">
          <el-input v-model="form.applyReason" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="审核原因" prop="auditReason">
          <el-input v-model="form.auditReason" type="textarea" placeholder="请输入内容" />
        </el-form-item>
        <el-form-item label="申请人" prop="applyBy">
          <el-input v-model="form.applyBy" placeholder="请输入申请人" />
        </el-form-item>
        <el-form-item label="申请时间" prop="applyDate">
          <el-date-picker clearable
            v-model="form.applyDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择申请时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="审核人" prop="auditBy">
          <el-input v-model="form.auditBy" placeholder="请输入审核人" />
        </el-form-item>
        <el-form-item label="审核时间" prop="auditDate">
          <el-date-picker clearable
            v-model="form.auditDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择审核时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="最后更新时间" prop="updateDate">
          <el-date-picker clearable
            v-model="form.updateDate"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择最后更新时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="执行开始时间" prop="beginTime">
          <el-date-picker clearable
            v-model="form.beginTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择执行开始时间">
          </el-date-picker>
        </el-form-item>
        <el-form-item label="执行结束时间" prop="endTime">
          <el-date-picker clearable
            v-model="form.endTime"
            type="date"
            value-format="yyyy-MM-dd"
            placeholder="请选择执行结束时间">
          </el-date-picker>
        </el-form-item>
        <el-divider content-position="center">原材料出库记录明细信息</el-divider>
        <el-row :gutter="10" class="mb8">
          <el-col :span="1.5">
            <el-button type="primary" icon="el-icon-plus" size="mini" @click="handleAddWmsRawOutstockDetail">添加</el-button>
          </el-col>
          <el-col :span="1.5">
            <el-button type="danger" icon="el-icon-delete" size="mini" @click="handleDeleteWmsRawOutstockDetail">删除</el-button>
          </el-col>
        </el-row>
        <el-table :data="wmsRawOutstockDetailList" :row-class-name="rowWmsRawOutstockDetailIndex" @selection-change="handleWmsRawOutstockDetailSelectionChange" ref="wmsRawOutstockDetail">
          <el-table-column type="selection" width="50" align="center" />
          <el-table-column label="序号" align="center" prop="index" width="50"/>
          <el-table-column label="库位编码" prop="locationCode" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.locationCode" placeholder="请输入库位编码" />
            </template>
          </el-table-column>
          <el-table-column label="物料条码" prop="materialBarcode" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.materialBarcode" placeholder="请输入物料条码" />
            </template>
          </el-table-column>
          <el-table-column label="物料ID" prop="materialId" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.materialId" placeholder="请输入物料ID" />
            </template>
          </el-table-column>
          <el-table-column label="批次;扫描条码时，从打印条码记录表中获取" prop="instockBatch" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.instockBatch" placeholder="请输入批次;扫描条码时，从打印条码记录表中获取" />
            </template>
          </el-table-column>
          <el-table-column label="生产日期;扫描条码时，从打印条码记录表中获取" prop="materialProductionDate" width="240">
            <template slot-scope="scope">
              <el-date-picker clearable v-model="scope.row.materialProductionDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择生产日期;扫描条码时，从打印条码记录表中获取" />
            </template>
          </el-table-column>
          <el-table-column label="计划数量" prop="planAmount" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.planAmount" placeholder="请输入计划数量" />
            </template>
          </el-table-column>
          <el-table-column label="出库数量" prop="outstockAmount" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.outstockAmount" placeholder="请输入出库数量" />
            </template>
          </el-table-column>
          <el-table-column label="执行状态(0待执行,1执行中,2执行完成)" prop="executeStatus" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.executeStatus" placeholder="请选择执行状态(0待执行,1执行中,2执行完成)">
                <el-option label="请选择字典生成" value="" />
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="同步ERP状态(0:失败,1成功)" prop="erpStatus" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.erpStatus" placeholder="请选择同步ERP状态(0:失败,1成功)">
                <el-option label="请选择字典生成" value="" />
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="出库人" prop="outstockPerson" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.outstockPerson" placeholder="请输入出库人" />
            </template>
          </el-table-column>
          <el-table-column label="出库时间" prop="outstockTime" width="240">
            <template slot-scope="scope">
              <el-date-picker clearable v-model="scope.row.outstockTime" type="date" value-format="yyyy-MM-dd" placeholder="请选择出库时间" />
            </template>
          </el-table-column>
          <el-table-column label="出库方式" prop="outstockWay" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.outstockWay" placeholder="请输入出库方式" />
            </template>
          </el-table-column>
          <el-table-column label="使用机台名称;出库扫描条码时，从打印条码记录表中获取" prop="machineName" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.machineName" placeholder="请输入使用机台名称;出库扫描条码时，从打印条码记录表中获取" />
            </template>
          </el-table-column>
          <el-table-column label="质检状态(0:待质检,1:合格,2:NG)" prop="qualityStatus" width="150">
            <template slot-scope="scope">
              <el-select v-model="scope.row.qualityStatus" placeholder="请选择质检状态(0:待质检,1:合格,2:NG)">
                <el-option label="请选择字典生成" value="" />
              </el-select>
            </template>
          </el-table-column>
          <el-table-column label="创建时间" prop="createDate" width="240">
            <template slot-scope="scope">
              <el-date-picker clearable v-model="scope.row.createDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择创建时间" />
            </template>
          </el-table-column>
          <el-table-column label="最后更新时间" prop="updateDate" width="240">
            <template slot-scope="scope">
              <el-date-picker clearable v-model="scope.row.updateDate" type="date" value-format="yyyy-MM-dd" placeholder="请选择最后更新时间" />
            </template>
          </el-table-column>
          <el-table-column label="每托数量" prop="stackAmount" width="150">
            <template slot-scope="scope">
              <el-input v-model="scope.row.stackAmount" placeholder="请输入每托数量" />
            </template>
          </el-table-column>
        </el-table>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="submitForm">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import { listRawoutstock, getRawoutstock, delRawoutstock, addRawoutstock, updateRawoutstock } from "@/api/wms/rawoutstock";

export default {
  name: "Rawoutstock",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 子表选中数据
      checkedWmsRawOutstockDetail: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 显示搜索条件
      showSearch: true,
      // 总条数
      total: 0,
      // 原材料出库记录表格数据
      rawoutstockList: [],
      // 原材料出库记录明细表格数据
      wmsRawOutstockDetailList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,
      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        taskCode: null,
        warehouseId: null,
        locationCode: null,
        orderId: null,
        planId: null,
        planDetailId: null,
        stationId: null,
        productId: null,
        operationType: null,
        taskType: null,
        applyReason: null,
        auditReason: null,
        auditStatus: null,
        executeStatus: null,
        applyBy: null,
        applyDate: null,
        auditBy: null,
        auditDate: null,
        updateDate: null,
        beginTime: null,
        endTime: null
      },
      // 表单参数
      form: {},
      // 表单校验
      rules: {
        taskCode: [
          { required: true, message: "任务编号;移库时必须不能为空", trigger: "blur" }
        ],
        warehouseId: [
          { required: true, message: "仓库ID;领料时需要保存不能为空", trigger: "blur" }
        ],
      }
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询原材料出库记录列表 */
    getList() {
      this.loading = true;
      listRawoutstock(this.queryParams).then(response => {
        this.rawoutstockList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    // 表单重置
    reset() {
      this.form = {
        rawOutstockId: null,
        taskCode: null,
        warehouseId: null,
        locationCode: null,
        orderId: null,
        planId: null,
        planDetailId: null,
        stationId: null,
        productId: null,
        operationType: null,
        taskType: null,
        applyReason: null,
        auditReason: null,
        auditStatus: null,
        executeStatus: null,
        applyBy: null,
        applyDate: null,
        auditBy: null,
        auditDate: null,
        updateBy: null,
        updateDate: null,
        beginTime: null,
        endTime: null
      };
      this.wmsRawOutstockDetailList = [];
      this.resetForm("form");
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 重置按钮操作 */
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    // 多选框选中数据
    handleSelectionChange(selection) {
      this.ids = selection.map(item => item.rawOutstockId)
      this.single = selection.length!==1
      this.multiple = !selection.length
    },
    /** 新增按钮操作 */
    handleAdd() {
      this.reset();
      this.open = true;
      this.title = "添加原材料出库记录";
    },
    /** 修改按钮操作 */
    handleUpdate(row) {
      this.reset();
      const rawOutstockId = row.rawOutstockId || this.ids
      getRawoutstock(rawOutstockId).then(response => {
        this.form = response.data;
        this.wmsRawOutstockDetailList = response.data.wmsRawOutstockDetailList;
        this.open = true;
        this.title = "修改原材料出库记录";
      });
    },
    /** 提交按钮 */
    submitForm() {
      this.$refs["form"].validate(valid => {
        if (valid) {
          this.form.wmsRawOutstockDetailList = this.wmsRawOutstockDetailList;
          if (this.form.rawOutstockId != null) {
            updateRawoutstock(this.form).then(response => {
              this.$modal.msgSuccess("修改成功");
              this.open = false;
              this.getList();
            });
          } else {
            addRawoutstock(this.form).then(response => {
              this.$modal.msgSuccess("新增成功");
              this.open = false;
              this.getList();
            });
          }
        }
      });
    },
    /** 删除按钮操作 */
    handleDelete(row) {
      const rawOutstockIds = row.rawOutstockId || this.ids;
      this.$modal.confirm('是否确认删除原材料出库记录编号为"' + rawOutstockIds + '"的数据项？').then(function() {
        return delRawoutstock(rawOutstockIds);
      }).then(() => {
        this.getList();
        this.$modal.msgSuccess("删除成功");
      }).catch(() => {});
    },
	/** 原材料出库记录明细序号 */
    rowWmsRawOutstockDetailIndex({ row, rowIndex }) {
      row.index = rowIndex + 1;
    },
    /** 原材料出库记录明细添加按钮操作 */
    handleAddWmsRawOutstockDetail() {
      let obj = {};
      obj.locationCode = "";
      obj.materialBarcode = "";
      obj.materialId = "";
      obj.instockBatch = "";
      obj.materialProductionDate = "";
      obj.planAmount = "";
      obj.outstockAmount = "";
      obj.executeStatus = "";
      obj.erpStatus = "";
      obj.outstockPerson = "";
      obj.outstockTime = "";
      obj.outstockWay = "";
      obj.machineName = "";
      obj.qualityStatus = "";
      obj.createDate = "";
      obj.updateDate = "";
      obj.stackAmount = "";
      this.wmsRawOutstockDetailList.push(obj);
    },
    /** 原材料出库记录明细删除按钮操作 */
    handleDeleteWmsRawOutstockDetail() {
      if (this.checkedWmsRawOutstockDetail.length == 0) {
        this.$modal.msgError("请先选择要删除的原材料出库记录明细数据");
      } else {
        const wmsRawOutstockDetailList = this.wmsRawOutstockDetailList;
        const checkedWmsRawOutstockDetail = this.checkedWmsRawOutstockDetail;
        this.wmsRawOutstockDetailList = wmsRawOutstockDetailList.filter(function(item) {
          return checkedWmsRawOutstockDetail.indexOf(item.index) == -1
        });
      }
    },
    /** 复选框选中数据 */
    handleWmsRawOutstockDetailSelectionChange(selection) {
      this.checkedWmsRawOutstockDetail = selection.map(item => item.index)
    },
    /** 导出按钮操作 */
    handleExport() {
      this.download('wms/rawoutstock/export', {
        ...this.queryParams
      }, `rawoutstock_${new Date().getTime()}.xlsx`)
    }
  }
};
</script>
