Commit e42092aa45762f081e555c55906d5150093a1c53

Authored by 杨泽宇
2 parents 222eb7e8 2cbd1f66
src/api/community/index.ts 0 → 100644
  1 +import request from '../request'
  2 +
  3 +// export const getTableList = async ( params: any ) => {
  4 +// let res: any = await request.post( '/neighborhood/getList', params, {headers: {'X-Token': '2ebb4ca07a7ac8af47a1c4b182ea124435f4001e'}} )
  5 +// return res
  6 +// }
  7 +// export const getTableList = async ( params: any ) => {
  8 +// let res: any = await request.get( '/neighborhood/getList',{headers: {'X-Token': '2ebb4ca07a7ac8af47a1c4b182ea124435f4001e'}} )
  9 +// return res
  10 +// }
  11 +export function getTableList(params) {
  12 + return request({
  13 + method: 'post',
  14 + url: '/neighborhood/getList',
  15 + params: params,
  16 + headers: {'X-Token': '2ebb4ca07a7ac8af47a1c4b182ea124435f4001e'}
  17 + })
  18 +}
... ...
src/components/Pagination/index.vue
... ... @@ -67,6 +67,7 @@ const emit = defineEmits<{
67 67 :page-size="pageSize"
68 68 layout="total, sizes, prev, pager, next, jumper"
69 69 :total="total"
  70 + background
70 71 @size-change="handleSizeChange"
71 72 @current-change="handleCurrentChange"
72 73 >
... ... @@ -78,4 +79,8 @@ const emit = defineEmits<{
78 79 .pagination-container {
79 80 padding: 10px;
80 81 }
  82 +.el-pagination {
  83 + margin-top: 30px;
  84 + text-align: right;
  85 +}
81 86 </style>
... ...
src/style/reset.scss
... ... @@ -69,3 +69,6 @@ div:focus {
69 69 .page-container {
70 70 padding: 30px;
71 71 }
  72 +.app-container {
  73 + padding: 30px;
  74 +}
72 75 \ No newline at end of file
... ...
src/views/community/index.vue
1 1 <script setup lang="ts">
2   -</script>
3   -<template>
4   -<div class="app-container">
5   -<p>啦啦啦</p>
6   -<!-- <el-form>
7   -<el-button type="primary">查询</el-button>
  2 +import { reactive, onMounted } from "vue";
  3 +import { getTableList } from "@/api/community";
  4 +import Pagination from "@/components/Pagination/index.vue";
8 5  
9   -</el-form> -->
  6 +interface Item {
  7 + name: string,
  8 + type: number,
  9 + id:number,
  10 +}
  11 + // 列表
  12 +const tableData:Array<Item> = reactive([])
10 13  
11   -</div>
12   -</template>
  14 +const data = reactive({
  15 + // 搜索列表参数
  16 + search: {
  17 + propertyId: 1,
  18 + type: 0,
  19 + name: null,
  20 + },
  21 + // 分页
  22 + total: 0,
  23 + pageNum: 1,
  24 + pageSize: 0,
13 25  
14   -<style>
  26 +});
15 27  
16   -.app-container {
17   - padding: 30px;
18   - border: 1px solid #000
19   -}
  28 +/**
  29 + * 列表查询
  30 + */
  31 +const search = () => {
  32 + getTableList(data.search)
  33 + .then((res) => {
  34 + data.tableList = res.data.data.list;
  35 + tableData.push(...res.data.data.list) ;
  36 + tableData.push({name:12131,type:'1',id:'1'}) ;
  37 + data.total = res.data.data.total;
  38 + data.pageSize = res.data.data.pageSize;
  39 + data.pageNum = res.data.data.pageNum;
  40 + data.tableList = res.data.data.list;
  41 + console.log(data.tableList);
  42 + console.log(tableData);
  43 + })
  44 + .catch((err) => {
  45 + console.log(err);
  46 + });
  47 +};
20 48  
  49 +onMounted(() => {
  50 + search();
  51 +});
  52 +</script>
  53 +<template>
  54 + <div class="app-container">
  55 + <el-form :inline="true" :model="data.search">
  56 + <el-form-item>
  57 + <el-input
  58 + placeholder="请输入社区名称"
  59 + v-model="data.search.name"
  60 + ></el-input>
  61 + </el-form-item>
  62 + <el-form-item
  63 + ><el-button type="primary" @click="search"
  64 + >查询</el-button
  65 + ></el-form-item
  66 + >
  67 + <el-row>
  68 + <el-form-item>
  69 + <el-button type="primary">导入</el-button>
  70 + <el-button type="primary">导出</el-button>
  71 + <el-button type="primary">新增</el-button>
  72 + </el-form-item>
  73 + </el-row>
  74 + </el-form>
  75 + <el-table border :data="tableData">
  76 + <el-table-column label="小区名称" prop="name"></el-table-column>
  77 + <el-table-column label="楼座数"></el-table-column>
  78 + <el-table-column label="储藏室数"></el-table-column>
  79 + <el-table-column label="车位数"></el-table-column>
  80 + <el-table-column label="所在地区"></el-table-column>
  81 + <el-table-column label="详细地址"></el-table-column>
  82 + <el-table-column label="操作">
  83 + <template #default>
  84 + <el-button type="text" size="mini">编辑</el-button>
  85 + <el-button type="text" size="mini">删除</el-button>
  86 + <el-button type="text" size="mini">楼宇管理</el-button>
  87 + </template>
  88 + </el-table-column>
  89 + </el-table>
  90 + <Pagination
  91 + :total="data.total"
  92 + :currentPage="data.pageNum"
  93 + :pageSize="data.pageSize"
  94 + @pageChange="getTableList"
  95 + ></Pagination>
  96 + </div>
  97 +</template>
21 98  
22   -</style>
23 99 \ No newline at end of file
  100 +<style></style>
... ...