|
|
|
@ -2,15 +2,11 @@ |
|
|
|
|
<div> |
|
|
|
|
<el-card shadow="hover" class="m-b-20"> |
|
|
|
|
<div> |
|
|
|
|
<div class="flex a-center m-b-20"> |
|
|
|
|
<p class="hr_tag"></p> |
|
|
|
|
<span>筛选</span> |
|
|
|
|
</div> |
|
|
|
|
<div> |
|
|
|
|
<div class="flex"> |
|
|
|
|
<div> |
|
|
|
|
<el-input placeholder="请输入分类名称" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input> |
|
|
|
|
</div> |
|
|
|
|
<div class="p-title m-b-20">筛选</div> |
|
|
|
|
|
|
|
|
|
<div class="flex"> |
|
|
|
|
<div> |
|
|
|
|
<el-input placeholder="请输入分类名称" prefix-icon="el-icon-search" v-model="keyword" clearable></el-input> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
@ -18,19 +14,18 @@ |
|
|
|
|
|
|
|
|
|
<el-card shadow="hover"> |
|
|
|
|
<div class="flex j-between m-b-20"> |
|
|
|
|
<div class="flex a-center"> |
|
|
|
|
<p class="hr_tag"></p> |
|
|
|
|
<span>分类管理</span> |
|
|
|
|
</div> |
|
|
|
|
<div class="p-title">分类管理</div> |
|
|
|
|
|
|
|
|
|
<div> |
|
|
|
|
<el-button type="primary" size="small" round @click="addFirst" v-auth>添加一级分类</el-button> |
|
|
|
|
</div> |
|
|
|
|
</div> |
|
|
|
|
<el-table :data="listData" class="table" stripe header-align="center" row-key="cid" :tree-props="treeProps"> |
|
|
|
|
<el-table-column type="index" width="100" label="序号" align="center"></el-table-column> |
|
|
|
|
<el-table :data="listData" class="table" stripe header-align="center" row-key="cid" :tree-props="treeProps" :indent="32"> |
|
|
|
|
<el-table-column type="index" width="60" label="序号" align="center"></el-table-column> |
|
|
|
|
<el-table-column prop="typeName" label="分类名称"></el-table-column> |
|
|
|
|
<el-table-column label="操作" width="200"> |
|
|
|
|
<template slot-scope="scope"> |
|
|
|
|
{{scope.$index}} |
|
|
|
|
<el-button type="text" v-if="scope.row.parentId == 0" @click="addSecond(scope.row)" v-auth>添加</el-button> |
|
|
|
|
<el-button type="text" @click="editType(scope.row)" v-auth>编辑</el-button> |
|
|
|
|
<el-button type="text" @click="handleDelete(scope.row)" v-auth>删除</el-button> |
|
|
|
@ -70,7 +65,7 @@ |
|
|
|
|
</template> |
|
|
|
|
|
|
|
|
|
<script> |
|
|
|
|
import { mapState } from 'vuex'; |
|
|
|
|
import { mapState } from 'vuex' |
|
|
|
|
export default { |
|
|
|
|
data() { |
|
|
|
|
return { |
|
|
|
@ -116,10 +111,16 @@ export default { |
|
|
|
|
} |
|
|
|
|
this.$post(this.api.listByPage,data) |
|
|
|
|
.then(res => { |
|
|
|
|
this.listData = res.data.list.list |
|
|
|
|
let list = res.data.list.list |
|
|
|
|
// list.map((n,i) => { |
|
|
|
|
// n.index = i + 1 |
|
|
|
|
// n.secondColumn.map((j,i) => { |
|
|
|
|
// j.index = i + 1 |
|
|
|
|
// }) |
|
|
|
|
// }) |
|
|
|
|
this.listData = list |
|
|
|
|
this.total = res.data.list.totalCount |
|
|
|
|
}) |
|
|
|
|
.catch(err => {}) |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}, |
|
|
|
|
handleCurrentChange(val) { |
|
|
|
|
this.page = val; |
|
|
|
@ -131,9 +132,9 @@ export default { |
|
|
|
|
}) |
|
|
|
|
.then(() => { |
|
|
|
|
this.$post(`${this.api.deleteById}?cid=${row.cid}`).then(res => { |
|
|
|
|
this.$message.success('删除成功'); |
|
|
|
|
this.$message.success('删除成功') |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}); |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}) |
|
|
|
|
.catch(() => {}); |
|
|
|
|
}, |
|
|
|
@ -155,9 +156,7 @@ export default { |
|
|
|
|
this.firstVisible = false |
|
|
|
|
this.getData() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
}); |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}else{ |
|
|
|
|
this.$post(this.api.AddOneLevel, data).then(res => { |
|
|
|
|
if(res.success){ |
|
|
|
@ -165,13 +164,10 @@ export default { |
|
|
|
|
this.firstVisible = false |
|
|
|
|
this.getData() |
|
|
|
|
} |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
}); |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
addSecond(row){ |
|
|
|
|
console.log(22,row) |
|
|
|
|
this.isAddSecond = true |
|
|
|
|
this.curRow = row |
|
|
|
|
this.secondVisible = true |
|
|
|
@ -209,18 +205,14 @@ export default { |
|
|
|
|
this.$message.success('添加成功'); |
|
|
|
|
this.secondVisible = false |
|
|
|
|
this.getData() |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
}); |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
}else{ |
|
|
|
|
data.cid = this.curRow.cid |
|
|
|
|
this.$post(this.api.modifyLevel, data).then(res => { |
|
|
|
|
this.$message.success('修改成功'); |
|
|
|
|
this.secondVisible = false |
|
|
|
|
this.getData() |
|
|
|
|
}) |
|
|
|
|
.catch(err => { |
|
|
|
|
}); |
|
|
|
|
}).catch(err => {}) |
|
|
|
|
} |
|
|
|
|
}, |
|
|
|
|
delData(row) { |
|
|
|
@ -231,10 +223,13 @@ export default { |
|
|
|
|
this.$del(`${this.api.deleteColumn}/${row.id}`).then(res => { |
|
|
|
|
this.$message.success('删除成功'); |
|
|
|
|
this.getData() |
|
|
|
|
}).catch(res => {}); |
|
|
|
|
}) |
|
|
|
|
.catch(() => {}); |
|
|
|
|
}).catch(res => {}) |
|
|
|
|
}).catch(() => {}) |
|
|
|
|
}, |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
</script> |
|
|
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
|
|
|
|
|
|
|
</style> |