From b6843b954a4facce8d6cc07467a1e72af5c8186e Mon Sep 17 00:00:00 2001
From: zrj <646384940@qq.com>
Date: Fri, 01 Nov 2024 18:29:20 +0800
Subject: [PATCH] 新增应急物资列表展示

---
 src/views/supplies/components/box/dataContent.vue |  163 +++++++++++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 154 insertions(+), 9 deletions(-)

diff --git a/src/views/supplies/components/box/dataContent.vue b/src/views/supplies/components/box/dataContent.vue
index 7152a88..a506ea5 100644
--- a/src/views/supplies/components/box/dataContent.vue
+++ b/src/views/supplies/components/box/dataContent.vue
@@ -9,17 +9,162 @@
  * Copyright (c) 2023 by ${git_name_email}, All Rights Reserved. 
 -->
 <script setup>
-import publicContent from './publicContent.vue'
+import publicContent from "./publicContent.vue";
+import { getList } from "@/api/emergencySupplies/emergencySupplies";
+import { reactive } from "vue";
+
+const loading = ref(false);
+
+const tableData = ref([]);
+const pages = {
+  page: 1,
+  pageSize: 13,
+  total: 0,
+};
+
+onMounted(() => {
+  getLists();
+});
+// 表格样式
+const tableCellStyle = ({ row, column }) => {
+  return { background: "#152851", color: "#fff" };
+};
+// 表格表头样式
+const headerCellStyle = ({}) => {
+  return {
+    background: "#152851",
+    color: "#fff",
+  };
+};
+// 搜索条件
+const formInline = reactive({
+  name: "",
+  ownership:''
+});
+
+// 提交查询
+const onSubmit = () => {
+  console.log("submit!");
+  getLists(formInline);
+};
+
+// 分页树改变
+const handleSizeChange = (val) => {
+  pages.pageSize = val;
+  getLists(formInline);
+}
+// 分页改变
+const handleCurrentChange = (val) => {
+  pages.page = val;
+  getLists(formInline);
+}
+// 重置条件
+const clearBtn = ()=>{
+  formInline.name = ''
+  formInline.ownership = ''
+  pages.page = 1
+  pages.pageSize=13
+  pages.total= 0
+  getLists(formInline);
+}
+
+// 查询分页数据
+function getLists(param = {}) {
+  param.current = pages.page;
+  param.size = pages.pageSize;
+  loading.value = true;
+  getList(param)
+    .then((res) => {
+      const data = res.data.data;
+      data.records.forEach((element) => {
+        if (element.firmId) {
+          element.ownership = "园区";
+        } else {
+          element.ownership = "企业";
+        }
+      });
+      tableData.value = data.records;
+      pages.total = data.total;
+      loading.value = false;
+    })
+    .catch((err) => {
+      loading.value = false;
+      console.log(err);
+    });
+}
 </script>
 
 <template>
-    <public-content>
-        <template #content>
-            <div>
-
-            </div>
-        </template>
-    </public-content>
+  <public-content>
+    <template #content>
+      <div>
+        <el-form :inline="true" :model="formInline" class="demo-form-inline">
+          <el-form-item label="名称">
+            <el-input
+              v-model="formInline.name"
+              placeholder="请输入名称"
+              clearable
+              style="width: 120px"
+            />
+          </el-form-item>
+          <el-form-item label="归属">
+            <el-select
+              v-model="formInline.ownership"
+              placeholder="请选择"
+              clearable
+              style="width: 120px"
+            >
+              <el-option label="园区" value="1" />
+              <el-option label="企业" value="2" />
+            </el-select>
+          </el-form-item>
+          <el-form-item>
+            <el-button type="primary" @click="onSubmit">查询</el-button>
+            <el-button type="" @click="clearBtn">重置</el-button>
+          </el-form-item>
+        </el-form>
+        <el-table
+          :data="tableData"
+          style="width: 100%"
+          :header-cell-style="headerCellStyle"
+          :cell-style="tableCellStyle"
+          v-loading="loading"
+        >
+          <el-table-column fixed prop="name" label="名称" />
+          <el-table-column prop="numUnit" label="数量" width="100" />
+          <!-- <el-table-column prop="firmName" label="单位名称" /> -->
+          <el-table-column prop="ownership" label="归属" width="100" />
+        </el-table>
+        <div class="el-page">
+          <el-pagination
+            background
+            layout="prev, pager, next"
+            :page-size="pages.pageSize"
+            :total="pages.total"
+             @size-change="handleSizeChange"
+            @current-change="handleCurrentChange"
+          />
+        </div>
+      </div>
+    </template>
+  </public-content>
 </template>
 
-<style lang="scss" scoped></style>
\ No newline at end of file
+<style lang="scss" scoped>
+.el-form-item__label {
+  color: #fff !important;
+}
+
+/* 当表格没有数据时,修改表格的背景颜色 */
+.el-table--empty .el-table__body {
+  background-color: #19284e !important; /* 你想要的背景颜色 */
+}
+
+.el-page {
+  margin-top: 10px;
+  width: 100%;
+  display: flex;
+  align-items: center;
+  // margin-bottom:10px;
+}
+</style>

--
Gitblit v1.9.3