@@ -10,6 +10,7 @@ import ReCard from "/@/components/ReCard";
10
10
import { ref , onMounted , nextTick } from " vue" ;
11
11
import DialogForm from " ./components/DialogForm.vue" ;
12
12
import { ElMessage , ElMessageBox } from " element-plus" ;
13
+ import { useRenderIcon } from " /@/components/ReIcon/src/hooks" ;
13
14
14
15
const svg = `
15
16
<path class="path" d="
@@ -94,86 +95,83 @@ const handleManageProduct = product => {
94
95
</script >
95
96
96
97
<template >
97
- <div >
98
- <div class =" list-card-operation" >
99
- <el-button @click =" formDialogVisible = true" > 新建产品 </el-button >
100
- <div class =" search-input" >
101
- <el-input
102
- v-model =" searchValue"
103
- placeholder =" 请输入你需要搜索的内容"
104
- clearable
105
- >
106
- <template #suffix >
107
- <el-icon class =" el-input__icon" >
108
- <IconifyIconOffline v-if =" searchValue === ''" icon =" search" />
109
- </el-icon >
110
- </template >
111
- </el-input >
112
- </div >
98
+ <div class =" main" >
99
+ <div class =" w-full flex justify-between mb-4" >
100
+ <el-button :icon =" useRenderIcon('add')" @click =" formDialogVisible = true"
101
+ >新建产品</el-button
102
+ >
103
+ <el-input
104
+ style =" width : 300px "
105
+ v-model =" searchValue"
106
+ placeholder =" 请输入产品名称"
107
+ clearable
108
+ >
109
+ <template #suffix >
110
+ <el-icon class =" el-input__icon" >
111
+ <IconifyIconOffline
112
+ v-show =" searchValue.length === 0"
113
+ icon =" search"
114
+ />
115
+ </el-icon >
116
+ </template >
117
+ </el-input >
113
118
</div >
114
119
<div
115
120
v-loading =" dataLoading"
116
121
:element-loading-svg =" svg"
117
122
element-loading-svg-view-box =" -10, -10, 50, 50"
118
123
>
124
+ <el-empty
125
+ description =" 暂无数据"
126
+ v-show ="
127
+ productList
128
+ .slice(
129
+ pagination.pageSize * (pagination.current - 1),
130
+ pagination.pageSize * pagination.current
131
+ )
132
+ .filter(v =>
133
+ v.name.toLowerCase().includes(searchValue.toLowerCase())
134
+ ).length === 0
135
+ "
136
+ />
119
137
<template v-if =" pagination .total > 0 " >
120
- <div class = " list-card-items " >
121
- <el-row :gutter = " 16 " >
122
- < el-col
123
- v-for = " product in productList .slice(
138
+ <el-row :gutter = " 16 " >
139
+ <el-col
140
+ v-for = " (product, index) in productList
141
+ .slice(
124
142
pagination.pageSize * (pagination.current - 1),
125
143
pagination.pageSize * pagination.current
144
+ )
145
+ .filter(v =>
146
+ v.name.toLowerCase().includes(searchValue.toLowerCase())
126
147
)"
127
- :key =" product.index"
128
- :xs =" 24"
129
- :sm =" 12"
130
- :md =" 8"
131
- :lg =" 6"
132
- :xl =" 4"
133
- >
134
- <ReCard
135
- class =" list-card-item"
136
- :product =" product"
137
- @delete-item =" handleDeleteItem"
138
- @manage-product =" handleManageProduct"
139
- />
140
- </el-col >
141
- </el-row >
142
- </div >
143
- <div class =" list-card-pagination" >
144
- <el-pagination
145
- v-model:currentPage =" pagination.current"
146
- :page-size =" pagination.pageSize"
147
- :total =" pagination.total"
148
- :page-sizes =" [12, 24, 36]"
149
- layout =" total, sizes, prev, pager, next"
150
- @size-change =" onPageSizeChange"
151
- @current-change =" onCurrentChange"
152
- />
153
- </div >
148
+ :key =" index"
149
+ :xs =" 24"
150
+ :sm =" 12"
151
+ :md =" 8"
152
+ :lg =" 6"
153
+ :xl =" 4"
154
+ >
155
+ <ReCard
156
+ :product =" product"
157
+ @delete-item =" handleDeleteItem"
158
+ @manage-product =" handleManageProduct"
159
+ />
160
+ </el-col >
161
+ </el-row >
162
+ <el-pagination
163
+ class =" float-right"
164
+ v-model:currentPage =" pagination.current"
165
+ :page-size =" pagination.pageSize"
166
+ :total =" pagination.total"
167
+ :page-sizes =" [12, 24, 36]"
168
+ :background =" true"
169
+ layout =" total, sizes, prev, pager, next, jumper"
170
+ @size-change =" onPageSizeChange"
171
+ @current-change =" onCurrentChange"
172
+ />
154
173
</template >
155
174
</div >
156
175
<DialogForm v-model:visible =" formDialogVisible" :data =" formData" />
157
176
</div >
158
177
</template >
159
-
160
- <style scoped lang="scss">
161
- .list-card {
162
- & -operation {
163
- display : flex ;
164
- justify-content : space-between ;
165
-
166
- .search-input {
167
- width : 360px ;
168
- }
169
- }
170
-
171
- & -items {
172
- margin : 14px 0 24px 0 ;
173
- }
174
-
175
- & -pagination {
176
- padding : 16px ;
177
- }
178
- }
179
- </style >
0 commit comments