warehouse.vue 4.76 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="warehouseCode"
              placeholder="请输入仓库编码"
            ></el-input>
          </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-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="warehouseCode"
            label="仓库编码"
          ></el-table-column>
          <el-table-column
            prop="warehouseName"
            label="仓库名称"
          ></el-table-column>
          <el-table-column prop="remark" label="备注"></el-table-column>
          <el-table-column prop="created" label="创建时间"></el-table-column>
          <el-table-column prop="createdBy" label="创建人"></el-table-column>
          <el-table-column prop="updated" label="更新时间"></el-table-column>
          <el-table-column prop="updatedBy" 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: "Warehouse",
  data() {
    return {
      warehouseCode: "",
      currentPage: 1,
      total: 0,
      pageSize: 10,
      selectedItems: [],
      tableData: [
        {
          id: 1,
          warehouseCode: "WH001",
          warehouseName: "主仓库",
          remark: "主要存储货物的仓库",
          created: "2023-01-01 10:00:00",
          createdBy: "admin",
          updated: "2023-01-02 14:30:00",
          updatedBy: "admin",
        },
        {
          id: 2,
          warehouseCode: "WH002",
          warehouseName: "分仓库",
          remark: "辅助存储货物的仓库",
          created: "2023-01-01 10:00:00",
          createdBy: "admin",
          updated: "2023-01-03 09:15:00",
          updatedBy: "admin",
        },
        {
          id: 3,
          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() {
      // 删除逻辑
    },
  },
};
</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>