charles
2024-04-29 61ee015a91fdf32e271c2c86c7257fb3776d8c69
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
92
93
94
<template>
    <div>
        <div class="search">
            <el-form :inline="true" class="demo-form-inline">
                <el-form-item label="文字内容/车号:">
                    <el-input v-model="keyword" size="small" placeholder="请输入"></el-input>
                </el-form-item>
                <el-form-item>
                    <el-button  @click="searchCar" size="mini" type="primary" style="border:none;background-color: rgba(24, 144, 255, 1)">查询</el-button>
                </el-form-item>
            </el-form>
        </div>
        <div>
            <el-table :data="pageInfo.textList" >
                <el-table-column prop="id" label="序号" align="center" />
                <el-table-column prop="textContent" label="文字内容" align="center" />
                <el-table-column prop="cid" label="车号" align="center" />
                <el-table-column prop="date" label="添加时间" align="center"  />
            </el-table>
            <div class="pagination">
                <div class="total">共计{{pageInfo.total}}条记录 第{{pageData.page}}/{{lastPage}}页</div>
                <div class="page">
                    <el-pagination
                            background
                            @size-change="handleSizeChange"
                            @current-change="handleCurrentChange"
                            :current-page.sync="pageData.page"
                            :page-size="pageData.pageSize"
                            layout="prev, pager, next,sizes, jumper"
                            :total="pageInfo.total">
                    </el-pagination>
                </div>
            </div>
        </div>
    </div>
</template>
 
<script>
    export default {
        name: "textManager",
        data(){
            return{
                keyword:'',
                pageInfo:{
                  total:100,
                  textList:[]
                },
                pageData:{page:1,pageSize:10}
            }
        },
        computed:{
          lastPage(){
              return Math.ceil(this.pageInfo.total/this.pageData.pageSize)
          }
        },
        methods:{
            searchCar(){
                //搜索
                this.pageInfo.textList=[
                    {id:1, textContent: '火车启动', cid: 'k12', date: '2016-05-02'},
                    {id:2, textContent: '火车启动', cid: 'k12', date: '2016-05-02'},
                    {id:3, textContent: '火车启动', cid: 'k12', date: '2016-05-02'},
                    {id:4, textContent: '火车启动', cid: 'k12', date: '2016-05-02'},
                    {id:5, textContent: '火车启动', cid: 'k12', date: '2016-05-02'},
                    {id:6, textContent: '火车启动', cid: 'k12', date: '2016-05-02'},
                    {id:7, textContent: '火车启动', cid: 'k12', date: '2016-05-02'},
                    {id:8, textContent: '火车启动', cid: 'k12', date: '2016-05-02'},
                    {id:9, textContent: '火车启动', cid: 'k12', date: '2016-05-02'},
                    {id:10, textContent: '火车启动', cid: 'k12', date: '2016-05-02'}
                ];
            },
            handleSizeChange(pageSize){
                this.pageData.pageSize=pageSize;
            },
            handleCurrentChange(page){
                this.pageData.page=page;
            }
        },
        mounted(){
            this.searchCar();
        }
    }
</script>
 
<style scoped lang="scss">
    .pagination{
        display: flex;
        justify-content: space-between;
        margin-top: 30px;
        .total{
            color: gray;
        }
    }
</style>