Blame view
src/views/prod/list.vue
4.19 KB
5cb375940 auto commit the c... |
1 2 |
<template> <div class="app-container"> |
a86b16bba auto commit the c... |
3 4 5 6 7 8 9 10 11 12 13 14 15 16 |
<!-- <el-header> </el-header> --> <template> <router-link :to="'/prod/create/1111'"> <el-button type="primary" size="small" icon="el-icon-edit" > create </el-button> </router-link> </template> |
5cb375940 auto commit the c... |
17 |
<el-table |
5cb375940 auto commit the c... |
18 19 |
v-loading="listLoading" :data="list" |
5cb375940 auto commit the c... |
20 21 22 23 24 25 26 |
border fit highlight-current-row style="width: 100%" > <el-table-column align="center" |
a86b16bba auto commit the c... |
27 |
label="pid" |
5cb375940 auto commit the c... |
28 |
> |
04e55fcfe auto commit the c... |
29 |
<template slot-scope="scope"> |
a86b16bba auto commit the c... |
30 |
<span>{{ scope.row.pid }}</span> |
5cb375940 auto commit the c... |
31 32 |
</template> </el-table-column> |
5cb375940 auto commit the c... |
33 |
<el-table-column |
5cb375940 auto commit the c... |
34 |
align="center" |
a86b16bba auto commit the c... |
35 |
label="pname" |
5cb375940 auto commit the c... |
36 |
> |
04e55fcfe auto commit the c... |
37 |
<template slot-scope="scope"> |
a86b16bba auto commit the c... |
38 |
<span>{{ scope.row.pname }}</span> |
5cb375940 auto commit the c... |
39 40 |
</template> </el-table-column> |
5cb375940 auto commit the c... |
41 |
<el-table-column |
5cb375940 auto commit the c... |
42 |
align="center" |
a86b16bba auto commit the c... |
43 |
label="参数信息" |
5cb375940 auto commit the c... |
44 |
> |
04e55fcfe auto commit the c... |
45 |
<template slot-scope="scope"> |
a86b16bba auto commit the c... |
46 47 48 49 50 51 |
<span>框宽{{ scope.row.prod_info_frame_width }}mm</span><br> <span>腿长{{ scope.row.prod_info_leg_long }}mm</span><br> <span>镜宽{{ scope.row.prod_info_glass_width }}mm</span><br> <span>镜高{{ scope.row.prod_info_glass_height }}mm</span><br> <span>鼻宽{{ scope.row.prod_info_norse_width }}mm</span><br> <span>重量{{ scope.row.prod_info_weight }}g</span> |
5cb375940 auto commit the c... |
52 53 54 55 |
</template> </el-table-column> <el-table-column |
a86b16bba auto commit the c... |
56 57 |
align="center" label="Date" |
5cb375940 auto commit the c... |
58 |
> |
04e55fcfe auto commit the c... |
59 |
<template slot-scope="scope"> |
a86b16bba auto commit the c... |
60 61 62 63 64 65 |
<span>{{ scope.row.timestamp | parseTime('{y}-{m}-{d} {h}:{i}') }}</span> </template> </el-table-column> <el-table-column label="Importance"> <template slot-scope="scope"> |
5cb375940 auto commit the c... |
66 |
<svg-icon |
04e55fcfe auto commit the c... |
67 |
v-for="n in +scope.row.importance" |
5cb375940 auto commit the c... |
68 69 |
:key="n" icon-class="star" |
04e55fcfe auto commit the c... |
70 |
class="meta-item__icon" |
5cb375940 auto commit the c... |
71 72 73 74 75 |
/> </template> </el-table-column> <el-table-column |
5cb375940 auto commit the c... |
76 |
class-name="status-col" |
a86b16bba auto commit the c... |
77 |
label="prod_status" |
5cb375940 auto commit the c... |
78 79 |
> <template slot-scope="{row}"> |
a86b16bba auto commit the c... |
80 81 |
<el-tag :type="row.prod_status | statusFilter"> {{ row.prod_status }} |
5cb375940 auto commit the c... |
82 83 84 85 86 87 |
</el-tag> </template> </el-table-column> <el-table-column align="center" |
04e55fcfe auto commit the c... |
88 |
label="Actions" |
5cb375940 auto commit the c... |
89 |
> |
a86b16bba auto commit the c... |
90 91 92 93 94 95 96 97 98 99 100 |
<template slot-scope="{row}"> <router-link :to="'/prod/edit/'+row.pid"> <el-button type="primary" size="small" icon="el-icon-edit" > Edit1 </el-button> </router-link> <router-link :to="'/prod/del/'+row.pid"> |
04e55fcfe auto commit the c... |
101 102 103 104 105 |
<el-button type="primary" size="small" icon="el-icon-edit" > |
a86b16bba auto commit the c... |
106 |
Edit2 |
04e55fcfe auto commit the c... |
107 108 |
</el-button> </router-link> |
5cb375940 auto commit the c... |
109 110 111 |
</template> </el-table-column> </el-table> |
04e55fcfe auto commit the c... |
112 113 114 115 116 117 118 119 |
<pagination v-show="total>0" :total="total" :page.sync="listQuery.page" :limit.sync="listQuery.limit" @pagination="getList" /> |
5cb375940 auto commit the c... |
120 121 122 123 |
</div> </template> <script> |
a86b16bba auto commit the c... |
124 125 |
import { fetchList } from '@/api/prod' // import { Pagination } from "@/components/Pagination"; // Secondary package based on el-pagination |
04e55fcfe auto commit the c... |
126 |
import Pagination from '@/components/Pagination' // Secondary package based on el-pagination |
5cb375940 auto commit the c... |
127 |
export default { |
a86b16bba auto commit the c... |
128 |
name: 'ProdList', |
04e55fcfe auto commit the c... |
129 |
components: { Pagination }, |
5cb375940 auto commit the c... |
130 |
filters: { |
a86b16bba auto commit the c... |
131 |
statusFilter(prod_status) { |
5cb375940 auto commit the c... |
132 133 134 135 136 |
const statusMap = { published: 'success', draft: 'info', deleted: 'danger' } |
a86b16bba auto commit the c... |
137 |
return statusMap[prod_status] |
5cb375940 auto commit the c... |
138 139 140 141 142 |
} }, data() { return { list: null, |
04e55fcfe auto commit the c... |
143 |
total: 0, |
5cb375940 auto commit the c... |
144 145 146 |
listLoading: true, listQuery: { page: 1, |
04e55fcfe auto commit the c... |
147 148 |
limit: 20 } |
5cb375940 auto commit the c... |
149 150 151 152 153 154 |
} }, created() { this.getList() }, methods: { |
04e55fcfe auto commit the c... |
155 |
getList() { |
5cb375940 auto commit the c... |
156 |
this.listLoading = true |
a86b16bba auto commit the c... |
157 |
console.log('getList', 'dddddd') |
04e55fcfe auto commit the c... |
158 159 160 161 |
fetchList(this.listQuery).then(response => { this.list = response.data.items this.total = response.data.total this.listLoading = false |
5cb375940 auto commit the c... |
162 163 164 165 166 |
}) } } } </script> |
5cb375940 auto commit the c... |
167 |
<style scoped> |
04e55fcfe auto commit the c... |
168 169 |
.edit-input { padding-right: 100px; |
5cb375940 auto commit the c... |
170 |
} |
04e55fcfe auto commit the c... |
171 172 173 174 |
.cancel-btn { position: absolute; right: 15px; top: 10px; |
5cb375940 auto commit the c... |
175 176 |
} </style> |