|
|
@ -16,12 +16,17 @@ |
|
|
|
:data="dataList" |
|
|
|
:default-expand-all="true" |
|
|
|
row-key="categoryId" |
|
|
|
:cell-style="cellStyle" |
|
|
|
border |
|
|
|
style="width: 100%;"> |
|
|
|
<el-table-column prop="categoryName" |
|
|
|
label="分类名称" |
|
|
|
header-align="center" |
|
|
|
min-width="150"></el-table-column> |
|
|
|
<el-table-column prop="stateShow" |
|
|
|
label="状态" |
|
|
|
header-align="center" |
|
|
|
min-width="150"></el-table-column> |
|
|
|
|
|
|
|
<!-- <el-table-column prop="sort" |
|
|
|
:label="$t('menu.sort')" |
|
|
@ -32,12 +37,12 @@ |
|
|
|
fixed="right" |
|
|
|
header-align="center" |
|
|
|
align="left" |
|
|
|
width="250"> |
|
|
|
width="350"> |
|
|
|
<template slot-scope="scope"> |
|
|
|
|
|
|
|
<el-button type="text" |
|
|
|
size="small" |
|
|
|
@click="disableCategory(scope.row)">{{ scope.row.stateShow}}</el-button> |
|
|
|
@click="disableCategory(scope.row)">{{ scope.row.btnShow}}</el-button> |
|
|
|
<el-button type="text" |
|
|
|
size="small" |
|
|
|
@click="editShow(scope.row)">修改</el-button> |
|
|
@ -103,6 +108,17 @@ export default { |
|
|
|
CategoryEdit |
|
|
|
}, |
|
|
|
methods: { |
|
|
|
cellStyle ({ row, column, rowIndex, columnIndex }) { |
|
|
|
|
|
|
|
// 状态列字体颜色 |
|
|
|
if (row.state === 'enable' && columnIndex === 1) { |
|
|
|
return 'color: #EA1B29' |
|
|
|
} else if (row.state === 'disable' && columnIndex === 1) { |
|
|
|
return 'color: #0CB618' |
|
|
|
} else { |
|
|
|
return 'color: #1a1a1b' |
|
|
|
} |
|
|
|
}, |
|
|
|
initData (customerId, customerName) { |
|
|
|
this.customerId = customerId |
|
|
|
this.customerName = customerName |
|
|
@ -118,20 +134,22 @@ export default { |
|
|
|
|
|
|
|
this.tableParams.customerId = this.customerId |
|
|
|
|
|
|
|
const { data, code, msg, internalMsg } = await requestPost(url, this.tableParams) |
|
|
|
const { data, code, msg } = await requestPost(url, this.tableParams) |
|
|
|
this.dataListLoading = false |
|
|
|
if (code === 0) { |
|
|
|
|
|
|
|
this.dataList = data |
|
|
|
this.dataList.forEach(element => { |
|
|
|
element.state = element.isDisable === 'enable' ? 'disable' : 'enable' |
|
|
|
element.stateShow = element.isDisable === 'enable' ? '禁用' : '启用' |
|
|
|
element.btnShow = element.isDisable === 'enable' ? '禁用' : '启用' |
|
|
|
element.stateShow = element.isDisable === 'enable' ? '启用' : '禁用' |
|
|
|
element.level = "l1" |
|
|
|
|
|
|
|
if (element.children.length > 0) { |
|
|
|
element.children.forEach(child => { |
|
|
|
child.state = child.isDisable === 'enable' ? 'disable' : 'enable' |
|
|
|
child.stateShow = child.isDisable === 'enable' ? '禁用' : '启用' |
|
|
|
child.btnShow = child.isDisable === 'enable' ? '禁用' : '启用' |
|
|
|
child.stateShow = child.isDisable === 'enable' ? '启用' : '禁用' |
|
|
|
child.level = "l2" |
|
|
|
child.parentCategoryId = element.categoryId |
|
|
|
}); |
|
|
@ -139,14 +157,14 @@ export default { |
|
|
|
}); |
|
|
|
|
|
|
|
} else { |
|
|
|
// this.$message.error(msg + ":" + internalMsg) |
|
|
|
// this.$message.error(msg ) |
|
|
|
} |
|
|
|
|
|
|
|
}, |
|
|
|
|
|
|
|
//开启/启用 |
|
|
|
disableCategory (row) { |
|
|
|
this.$confirm('确认' + row.stateShow + '当前分类?', '提示', { |
|
|
|
this.$confirm('确认' + row.btnShow + '当前分类?', '提示', { |
|
|
|
confirmButtonText: '确定', |
|
|
|
cancelButtonText: '取消', |
|
|
|
type: 'warning' |
|
|
|