index.vue
4.6 KB
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
<template>
<main class="list_container">
<section class="search_bar">
<el-form :inline="true" :model="queryForm" size="small" class="demo-form-inline">
<el-form-item label="名称">
<el-input v-model="queryForm.title" placeholder="请输入标题"></el-input>
</el-form-item>
<el-form-item label="发布日期">
<el-date-picker v-model="queryForm.pushlishTime" type="daterange" range-separator="-" start-placeholder="开始时间" end-placeholder="结束时间">
</el-date-picker>
</el-form-item>
<el-form-item>
<el-button type="primary" @click="searchController">查 询</el-button>
<el-button @click="searchController">重 置</el-button>
</el-form-item>
</el-form>
<div class="operation_bar">
<el-button type="primary" size="small" icon="el-icon-plus">新建</el-button>
</div>
</section>
<section class="list_content">
<div class="table_wrap">
<el-table :data="tableData" size="small" style="width: 100%" :header-cell-style="headerStyle" :cell-style="cellStyle">
<el-table-column prop="date" label="序号" width="80">
</el-table-column>
<el-table-column prop="name" label="标题">
</el-table-column>
<el-table-column prop="address" label="缩略图">
</el-table-column>
<el-table-column prop="address" label="排序">
</el-table-column>
<el-table-column prop="address" label="发布日期">
</el-table-column>
<el-table-column prop="address" label="启用">
<template slot-scope="scope">
<el-switch v-model="scope.status" active-color="#13ce66" inactive-color="#ff4949">
</el-switch>
</template>
</el-table-column>
<el-table-column prop="address" label="操作">
<template slot-scope="scope">
<el-button @click.native.prevent="deleteRow(scope.$index, tableData)" type="text" size="small">
编辑
</el-button>
<el-button @click.native.prevent="deleteRow(scope.$index, tableData)" type="text" size="small">
删除
</el-button>
</template>
</el-table-column>
</el-table>
</div>
<div class="pagination_wrap">
<el-pagination @size-change="handleSizeChange" @current-change="handleCurrentChange" :current-page="currentPage" :page-sizes="[1, 2, 3, 4]" :page-size="pageSize" layout="slot, prev, pager, next" :total="totalItems">
<span class="total_items">共{{totalItems}}条记录</span>
<span class="current_page">{{currentPage}}/{{totalPages}}页</span>
</el-pagination>
</div>
</section>
</main>
</template>
<script>
export default {
name: 'CarouseManage',
computed: {
totalPages() {
return Math.ceil(this.totalItems/this.pageSize)
}
},
data() {
return {
swichTime: 3,
queryForm: {},
tableData: [],
currentPage: 1,
pageSize: 10,
totalItems: 2,
headerStyle: {
background: '#FAFAFA',
color: '#101010',
textAlign: 'center',
fontSize: '14px'
},
cellStyle: {
textAlign: 'center',
fontSize: '14px'
}
}
},
methods: {
searchController() {
},
handleSizeChange(val) {
console.log(`每页 ${val} 条`);
},
handleCurrentChange(val) {
console.log(`当前页: ${val}`);
}
}
}
</script>
<style lang="scss" scoped>
.list_container {
width: 100%;
height: 100%;
background: #ffffff;
padding: 30px;
.el-button--small {
border-radius: 5px;
// font-size: 14px;
// padding: 0px 15px;
// line-height: 30px;
}
.operation_bar {
margin: 10px 0;
}
.el-table {
border: 1px solid #dfe6ec;
border-bottom: none;
}
.pagination_wrap {
text-align: right;
margin-top: 15px;
.el-pagination {
padding: 0;
span {
font-size: 14px;
margin-right: 10px;
// &.current_page {
// margin-right: 20px;
// }
}
::v-deep .el-pager {
li {
border: 1px solid #d8d8d8;
border-radius: 5px;
margin-right: 8px;
&.active {
background-color: #177ec6;
border-color: #177ec6;
color: #ffffff;
}
}
}
::v-deep.btn-prev,
::v-deep.btn-next {
border: 1px solid #d8d8d8;
border-radius: 5px;
padding: 0 10px;
&.btn-prev {
margin-right: 8px;
}
}
}
}
}
</style>