Browse Source

分类管理

master
jiangyy 4 years ago
parent
commit
4324a93a69
  1. 32
      epmet-oper-web/src/views/modules/customer/customize/CategoryList.vue

32
epmet-oper-web/src/views/modules/customer/customize/CategoryList.vue

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

Loading…
Cancel
Save