|
|
@@ -108,8 +108,22 @@
|
|
|
</span>
|
|
|
</template>
|
|
|
</el-table-column>
|
|
|
- <el-table-column align="center" fixed="right" label="操作" show-overflow-tooltip width="120">
|
|
|
+ <el-table-column align="center" fixed="right" label="操作" show-overflow-tooltip width="150">
|
|
|
<template #default="{ row }">
|
|
|
+ <el-button
|
|
|
+ v-show="row.state == '20'"
|
|
|
+ v-permissions="['base:product:edit']"
|
|
|
+ type="text"
|
|
|
+ @click="changeState(row)">
|
|
|
+ 启用
|
|
|
+ </el-button>
|
|
|
+ <el-button
|
|
|
+ v-show="row.state != '20'"
|
|
|
+ v-permissions="['base:product:edit']"
|
|
|
+ type="text"
|
|
|
+ @click="changeState(row)">
|
|
|
+ 停用
|
|
|
+ </el-button>
|
|
|
<el-button v-permissions="['base:product:edit']" type="text" @click="handleEdit(row)">编辑</el-button>
|
|
|
<el-button v-permissions="['base:product:delete']" type="text" @click="handleDelete(row)">删除</el-button>
|
|
|
</template>
|
|
|
@@ -136,6 +150,7 @@
|
|
|
import Edit from './components/ProductEdit'
|
|
|
import productApi from '@/api/base/product'
|
|
|
import TableTool from '@/components/table/TableTool'
|
|
|
+ import to from 'await-to-js'
|
|
|
|
|
|
export default {
|
|
|
name: 'Product',
|
|
|
@@ -220,6 +235,17 @@
|
|
|
this.fetchData()
|
|
|
},
|
|
|
methods: {
|
|
|
+ async changeState(row) {
|
|
|
+ let params = JSON.parse(JSON.stringify(row))
|
|
|
+ if (params.state == '20') {
|
|
|
+ params.state = '10'
|
|
|
+ } else {
|
|
|
+ params.state = '20'
|
|
|
+ }
|
|
|
+ const [err, res] = await to(productApi.updateState(params))
|
|
|
+ if (err) return
|
|
|
+ this.fetchData()
|
|
|
+ },
|
|
|
// 节点单击事件
|
|
|
handleNodeClick(data) {
|
|
|
this.queryForm.prodClass = data.key
|