This commit is contained in:
wangting 2024-05-13 11:48:49 +08:00
parent e689f0e99c
commit 95cac1a3d1
1 changed files with 49 additions and 9 deletions

View File

@ -101,16 +101,39 @@
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row>
<el-table v-loading="loading" :data="categoryList" @selection-change="handleSelectionChange">
<!-- <el-table v-loading="loading" :data="categoryList" @selection-change="handleSelectionChange">
<el-table-column type="selection" width="55" align="center" />
<!-- <el-table-column label="分类ID" align="center" prop="categoryId" />-->
<el-table-column label="分类名称" align="center" prop="categoryName" />
<!-- <el-table-column label="父ID" align="center" prop="parentId" />-->
<!-- <el-table-column label="ids" align="center" prop="ancestors" />-->
<!-- <el-table-column label="排序" align="center" prop="sort" />-->
<el-table-column label="分类描述" align="center" prop="description" />
<el-table-column label="语言标签" align="center" prop="tagName" />
<!-- <el-table-column label="状态" align="center" prop="status" />-->
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
size="mini"
type="text"
icon="el-icon-edit"
@click="handleUpdate(scope.row)"
v-hasPermi="['system:category:edit']"
>修改</el-button>
<el-button
size="mini"
type="text"
icon="el-icon-delete"
@click="handleDelete(scope.row)"
v-hasPermi="['system:category:remove']"
>删除</el-button>
</template>
</el-table-column>
</el-table> -->
<el-table
:data="categoryList"
style="width: 100%;margin-bottom: 20px;"
row-key="categoryId"
border
:tree-props="{children: 'children', hasChildren: 'hasChildren'}">
<el-table-column label="分类名称" prop="categoryName" />
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope">
<el-button
@ -131,13 +154,13 @@
</el-table-column>
</el-table>
<pagination
<!-- <pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
/> -->
<!-- 添加或修改文章分类管理对话框 -->
<el-dialog :title="title" :visible.sync="open" width="70%" append-to-body>
@ -241,9 +264,26 @@ export default {
getList() {
this.loading = true;
listCategory(this.queryParams).then(response => {
this.categoryList = response.rows;
// this.categoryList = response.rows;
this.total = response.total;
this.loading = false;
let arrData = response.rows
let newArr = []
for(let i=0;i<arrData.length;i++){
if(arrData[i].parentId==0){
newArr.push(arrData[i])
}
}
for(let i=0;i<newArr.length;i++){
newArr[i].children = []
for(let j=0;j<arrData.length;j++){
if(newArr[i].categoryId == arrData[j].parentId){
newArr[i].children.push(arrData[j])
}
}
}
this.categoryList = newArr
});
},
getColumList(){