|
|
@@ -97,6 +97,11 @@
|
|
|
<span>{{ row.dataSource }}</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
+ <el-table-column label="状态" align="center" width="100px">
|
|
|
+ <template slot-scope="{row}">
|
|
|
+ <span>{{ row.status | statusFilter }}</span>
|
|
|
+ </template>
|
|
|
+ </el-table-column>
|
|
|
<el-table-column label="创建时间" width="180px" align="center">
|
|
|
<template slot-scope="{row}">
|
|
|
<span>{{ row.createTime }}</span>
|
|
|
@@ -110,7 +115,7 @@
|
|
|
<el-table-column label="操作" align="center" class-name="small-padding" fixed="right" width="90">
|
|
|
<template slot-scope="{row,$index}">
|
|
|
<el-dropdown @command="handleCommand">
|
|
|
- <el-button size="small" @click.stop="{}" type="primary">
|
|
|
+ <el-button :disabled="row.status === -1" size="small" @click.stop="{}" type="primary">
|
|
|
操作<i class="el-icon-arrow-down el-icon--right"></i>
|
|
|
</el-button>
|
|
|
<el-dropdown-menu slot="dropdown">
|
|
|
@@ -166,6 +171,7 @@ import axios from 'axios'
|
|
|
import { getToken } from '@/utils/auth'
|
|
|
|
|
|
const foodTypes = { 0: '主材', 1: '辅材' }
|
|
|
+const foodStatus = { '-1': '删除', '0': '下架', '1': '上架' }
|
|
|
|
|
|
export default {
|
|
|
name: 'FoodList',
|
|
|
@@ -173,6 +179,9 @@ export default {
|
|
|
filters: {
|
|
|
foodTypeFilter(value) {
|
|
|
return foodTypes[value]
|
|
|
+ },
|
|
|
+ statusFilter(value) {
|
|
|
+ return foodStatus[value.toString()]
|
|
|
}
|
|
|
},
|
|
|
data() {
|
|
|
@@ -225,6 +234,7 @@ export default {
|
|
|
remove(row.id).then(res => {
|
|
|
this.$notify({ title: '成功', message: '删除成功', type: 'success', duration: 2000 })
|
|
|
this.list.splice(index, 1)
|
|
|
+ this.fetchData()
|
|
|
}).catch(res => {
|
|
|
this.$message.error(res.data.message)
|
|
|
})
|