emptyContainerDialog.vue 5.07 KB
<template>
  <el-dialog
    title="空托盘选取"
    :visible.sync="visible"
    :showcontainer="showcontainer"
    width="800px"
    append-to-body
    @close="$emit('update:showcontainer', false)"
  >
    <el-form
      :model="queryParams"
      ref="queryForm"
      :inline="true"
      v-show="showSearch"
      label-width="68px"
    >
      <el-form-item label="容器编码" prop="containerCode">
        <el-input
          v-model="queryParams.containerCode"
          placeholder="请输入容器编码"
          clearable
          size="small"
          style="width: 240px"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="库位编码" prop="locationCode">
        <el-input
          v-model="queryParams.locationCode"
          placeholder="请输入库位编码"
          clearable
          size="small"
          style="width: 240px"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button
          type="cyan"
          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">
      <right-toolbar
        :showSearch.sync="showSearch"
        @queryTable="getList"
      ></right-toolbar>
    </el-row>

    <el-table v-loading="loading" :data="containerList">
      <el-table-column
        label="操作"
        align="center"
        class-name="small-padding fixed-width"
        width="120"
      >
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit-outline"
            @click="handleSelect(scope.row)"
            >选取</el-button
          >
        </template>
      </el-table-column>
      <el-table-column
        label="库位编码"
        align="center"
        prop="code"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="容器编码"
        align="center"
        prop="containerCode"
        :show-overflow-tooltip="true"
      />
      <el-table-column label="仓库编码" align="center" prop="warehouseCode" />
      <el-table-column label="行" align="center" prop="iRow" width="55" />
      <el-table-column label="列" align="center" prop="iColumn" width="55" />
      <el-table-column label="层" align="center" prop="iLayer" width="55" />
      <el-table-column label="格" align="center" prop="iGrid" width="55" />
      <el-table-column
        label="库位类型"
        align="center"
        prop="locationType"
        width="80"
      />
      <el-table-column label="库区" align="center" prop="zoneCode" width="60" />
      <el-table-column label="状态" align="center" prop="status" width="60" />
      <el-table-column
        label="创建时间"
        align="center"
        prop="created"
        width="160"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.created) }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="创建用户"
        align="center"
        prop="createdBy"
        :show-overflow-tooltip="true"
      />
      <el-table-column
        label="更新时间"
        align="center"
        prop="lastUpdated"
        width="160"
      >
        <template slot-scope="scope">
          <span>{{ parseTime(scope.row.lastUpdated) }}</span>
        </template>
      </el-table-column>
      <el-table-column
        label="更新用户"
        align="center"
        prop="lastUpdatedBy"
        :show-overflow-tooltip="true"
      />
    </el-table>

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

<script>
import { listEmptyContainer } from "@/api/inventory/inventoryHeader/header";
export default {
  props: {
    showcontainer: {
      type: Boolean,
      default: false,
    },
  },
  data() {
    return {
      visible: this.showcontainer,
      loading: true,
      showSearch: true,
      total: 0,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        containerCode: undefined,
        locationCode: undefined,
      },
      containerList: [],
    };
  },
  watch: {
    showcontainer() {
      this.visible = this.showcontainer;
    },
  },
  created() {
    this.getList();
  },
  methods: {
    getList() {
      this.loading = true;
      listEmptyContainer(this.queryParams).then((response) => {
        this.containerList = response.rows;
        this.total = response.total;
        this.loading = false;
      });
    },

    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    resetQuery() {
      this.resetForm("queryForm");
      this.handleQuery();
    },
    handleSelect(row) {
      this.visible = false;
      this.$emit("passValue", row.code, row.containerCode);
    },
  },
};
</script>