container.vue 6.88 KB
<template>
  <el-container style="padding: 20px">
    <el-aside>
      <el-card :style="{ height: asideHeight }">
        <el-form label-width="80px">
          <el-form-item label="容器编码">
            <el-input
              v-model="containerCode"
              placeholder="请输入容器编码"
            ></el-input>
          </el-form-item>
          <el-form-item label="库存状态">
            <el-select v-model="warehouseStatus" placeholder="请选择库存状态">
              <el-option label="全部" value="all"></el-option>
              <el-option label="在库" value="normal"></el-option>
              <el-option label="不在库" value="disabled"></el-option>
            </el-select>
          </el-form-item>
          <el-form-item label="打印状态">
            <el-select v-model="printStatus" placeholder="请选择打印状态">
              <el-option label="全部" value="all"></el-option>
              <el-option label="已打印" value="printed"></el-option>
              <el-option label="未打印" value="unprinted"></el-option>
            </el-select>
          </el-form-item>

          <el-form-item label="数量">
            <div style="display: flex; align-items: center; margin-left: -80px">
              <el-input-number
                v-model="stepNumber"
                :min="1"
                :max="1000"
                label="数量"
              ></el-input-number>
              <span style="flex: 1 1 20%; max-width: 20%">份</span>
              <el-button
                type="primary"
                size="small"
                @click="handlePrint"
                style="flex: 1 1 20%; max-width: 20%"
              >
                打印
              </el-button>
            </div>
          </el-form-item>
          <el-form-item>
            <el-row>
              <el-col :span="8">
                <el-button type="primary" size="small" @click="handleQuery"
                  >查询</el-button
                >
              </el-col>
              <el-col :span="8">
                <el-button type="success" size="small" @click="handleAdd"
                  >新增</el-button
                >
              </el-col>
            </el-row>
            <el-row style="margin-top: 5px">
              <el-col :span="8">
                <el-button type="warning" size="small" @click="handleEdit"
                  >编辑</el-button
                >
              </el-col>
              <el-col :span="8">
                <el-button type="danger" size="small" @click="handleDelete"
                  >删除</el-button
                >
              </el-col>
            </el-row>
            <el-row>
              <el-col :span="8" :offset="4">
                <el-button type="success" size="small" @click="handleQuery"
                  >导出</el-button
                >
              </el-col>
            </el-row>
          </el-form-item>
        </el-form>
      </el-card>
    </el-aside>
    <el-main>
      <el-card>
        <el-table
          :data="tableData"
          style="width: 100%"
          :height="TableHeight"
          border
          stripe
          @selection-change="handleSelectionChange"
        >
          <el-table-column type="selection" width="55"></el-table-column>
          <el-table-column prop="id" label="id"></el-table-column>
          <el-table-column
            prop="containerCode"
            label="容器编码"
          ></el-table-column>
          <el-table-column prop="status" label="状态"></el-table-column>
          <el-table-column prop="printCount" label="打印次数"></el-table-column>
          <el-table-column
            prop="containerType"
            label="容器类型"
          ></el-table-column>
          <el-table-column
            prop="warehouseCode"
            label="仓库编码"
          ></el-table-column>
        </el-table>
        <el-pagination
          style="margin-top: 15px"
          align="center"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="currentPage"
          :page-sizes="[10, 20, 50, 100]"
          :page-size="pageSize"
          layout="total, sizes, prev, pager, next, jumper"
          :total="this.tableData.length"
        />
      </el-card>
    </el-main>
  </el-container>
</template>

<script>
export default {
  name: "container",
  data() {
    return {
      containerCode: "",
      currentPage: 1,
      total: 0,
      pageSize: 10,
      selectedItems: [],

      printStatus: "all",
      warehouseStatus: "all",
      stepNumber: 1,
      tableData: [
        {
          id: 1,
          containerCode: "CT001",
          status: "正常",
          printCount: 3,
          containerType: "类型A",
          warehouseCode: "WH001",
          warehouseName: "主仓库",
          remark: "主要存储货物的仓库",
          created: "2023-01-01 10:00:00",
          createdBy: "admin",
          updated: "2023-01-02 14:30:00",
          updatedBy: "admin",
        },
        {
          id: 2,
          containerCode: "CT002",
          status: "异常",
          printCount: 1,
          containerType: "类型B",
          warehouseCode: "WH002",
          warehouseName: "分仓库",
          remark: "辅助存储货物的仓库",
          created: "2023-01-01 10:00:00",
          createdBy: "admin",
          updated: "2023-01-03 09:15:00",
          updatedBy: "admin",
        },
        {
          id: 3,
          containerCode: "CT003",
          status: "待处理",
          printCount: 0,
          containerType: "类型C",
          warehouseCode: "WH003",
          warehouseName: "临时仓库",
          remark: "临时存储货物的仓库",
          created: "2023-01-01 10:00:00",
          createdBy: "admin",
          updated: "2023-01-04 16:45:00",
          updatedBy: "admin",
        },
      ],
    };
  },
  computed: {
    TableHeight() {
      return `calc(100vh - 220px )`;
    },
    asideHeight() {
      return `calc(100vh - 150px)`;
    },
  },
  methods: {
    handleSelectionChange(val) {
      this.selectedItems = val;
      // console.log("选中的行数据:", this.selectedItems);
    },
    handleSizeChange(val) {
      this.pageSize = val;
      this.currentPage = 1;
      this.handleQuery();
    },

    handleCurrentChange(val) {
      this.currentPage = val;
      this.handleQuery();
    },
    handleQuery() {
      // 查询逻辑
    },
    handleAdd() {
      // 新增逻辑
    },
    handleEdit() {
      // 编辑逻辑
    },
    handleDelete() {
      // 删除逻辑
    },
    // 新增打印方法
    handlePrint() {
      console.log(`打印 ${this.stepNumber} 份`);
      // 这里可以添加实际的打印逻辑
    },
  },
};
</script>

<style scoped>
.el-card__body,
.el-main {
  padding: 0 10px 0 10px;
}
::v-deep.el-table thead {
  color: #101010;
  font-weight: 600;
}
.el-form-item {
  margin-bottom: 18px;
}
/* 样式定义 */
</style>