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