ZN
21 小时以前 077ab59c700b85efdd057265bf752ad5942395b2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
<template>
  <div class="app-container">
    <div class="search_form">
      <div>
        <span class="search_title ml10">产品名称:</span>
        <el-input
          v-model="searchForm.productName"
          style="width: 240px"
          placeholder="请输入"
          clearable
          @keyup.enter="handleQuery"
        />
        <el-button type="primary" @click="handleQuery" style="margin-left: 10px">搜索</el-button>
      </div>
    </div>
 
    <div class="table_list">
      <el-table
        :data="tableData"
        border
        v-loading="tableLoading"
        style="width: 100%"
        height="calc(100vh - 18.5em)"
      >
        <el-table-column align="center" label="序号" type="index" width="60" />
        <el-table-column label="产品名称" prop="productName" min-width="180" show-overflow-tooltip />
        <el-table-column label="规格型号" prop="model" min-width="160" show-overflow-tooltip />
        <el-table-column label="单位" prop="unit" width="100" show-overflow-tooltip />
        <el-table-column label="库存数量" prop="qualitity" width="110" show-overflow-tooltip />
        <el-table-column label="冻结数量" prop="lockedQuantity" width="110" show-overflow-tooltip />
        <el-table-column label="最近更新时间" prop="updateTime" width="180" show-overflow-tooltip />
        <el-table-column label="备注" prop="remark" min-width="140" show-overflow-tooltip />
      </el-table>
 
      <Pagination
        v-show="total > 0"
        :total="total"
        :page="page.current"
        :limit="page.size"
        @pagination="paginationChange"
      />
    </div>
  </div>
</template>
 
<script setup>
import { reactive, ref, toRefs } from "vue";
import Pagination from "@/components/PIMTable/Pagination.vue";
import { getConsumablesInListPage } from "@/api/consumablesLogistics/consumablesIn.js";
 
const tableData = ref([]);
const tableLoading = ref(false);
 
const page = reactive({
  current: 1,
  size: 100,
});
const total = ref(0);
 
const data = reactive({
  searchForm: {
    productName: "",
  },
});
const { searchForm } = toRefs(data);
 
const handleQuery = () => {
  page.current = 1;
  getList();
};
 
const paginationChange = obj => {
  page.current = obj.page;
  page.size = obj.limit;
  getList();
};
 
const getList = () => {
  tableLoading.value = true;
  getConsumablesInListPage({ ...searchForm.value, ...page })
    .then(res => {
      tableData.value = res?.data?.records || [];
      total.value = res?.data?.total || 0;
    })
    .finally(() => {
      tableLoading.value = false;
    });
};
 
getList();
</script>