This commit is contained in:
PQZ 2025-06-25 16:16:21 +08:00
parent 7a83471684
commit 60d2a7efb3
3 changed files with 42 additions and 8 deletions

View File

@ -7,6 +7,7 @@ import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.DlBaseEntity; import com.ruoyi.common.core.domain.DlBaseEntity;
import lombok.Data; import lombok.Data;
import java.util.ArrayList;
import java.util.List; import java.util.List;
@ -21,6 +22,6 @@ public class BusiCategoryVO extends BusiCategory {
/** /**
* 子集 * 子集
*/ */
private List<BusiCategory> children; private List<BusiCategory> children = new ArrayList<>();
} }

View File

@ -52,6 +52,8 @@ export default {
catgName:"", catgName:"",
catgType:"", catgType:"",
}, },
//
query:{},
// //
rules:{ rules:{
code: [ code: [
@ -66,10 +68,20 @@ export default {
} }
} }
}, },
created() {
this.query = this.$route.query
},
methods:{ methods:{
/**确定按钮*/ /**确定按钮*/
submitForm(){ submitForm(){
if (this.query.catgLevel){
this.form.catgLevel = this.query.catgLevel
}
if (this.query.parentId){
this.form.parentId = this.query.parentId
}
addCategory(this.form).then((res) => { addCategory(this.form).then((res) => {
if (res.code == 200){ if (res.code == 200){
this.$modal.msgSuccess("保存成功"); this.$modal.msgSuccess("保存成功");

View File

@ -26,23 +26,36 @@
</el-col> </el-col>
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar> <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
</el-row> </el-row>
<el-table v-loading="loading" :data="categoryList" > <el-table
<el-table-column label="栏目名称" align="center" prop="catgName" /> row-key="id"
<el-table-column label="栏目级别" align="center" prop="catgLevel" /> border
:tree-props="{children: 'children', hasChildren: 'hasChildren'}"
v-loading="loading" :data="categoryList" >
<el-table-column label="栏目名称" align="left" prop="catgName" />
<el-table-column label="栏目级别" align="center" prop="catgLevel">
<template slot-scope="scope">
{{scope.row.catgLevel}}级栏目
</template>
</el-table-column>
<el-table-column label="栏目类型" align="center" prop="catgType" > <el-table-column label="栏目类型" align="center" prop="catgType" >
<template slot-scope="scope"> <template slot-scope="scope">
<dict-tag :options="dict.type.category_type" :value="scope.row.catgType"/> <dict-tag :options="dict.type.category_type" :value="scope.row.catgType"/>
</template> </template>
</el-table-column> </el-table-column>
<el-table-column label="排序" align="center" prop="sort" /> <el-table-column label="排序" align="center" prop="sort" />
<el-table-column label="修改时间" align="center" prop="updateTime" /> <el-table-column label="修改时间" align="center" prop="updateTime">
<template slot-scope="scope">
<span v-if="scope.row.updateTime == null">{{scope.row.createTime}}</span>
<span v-else>{{scope.row.updateTime}}</span>
</template>
</el-table-column>
<el-table-column label="操作" align="center" class-name="small-padding fixed-width"> <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
<template slot-scope="scope"> <template slot-scope="scope">
<el-button <el-button
size="mini" size="mini"
type="text" type="text"
icon="el-icon-edit" icon="el-icon-edit"
@click="handleUpdate(scope.row)" @click="handleChildAdd(scope.row)"
v-hasPermi="['busi:category:edit']" v-hasPermi="['busi:category:edit']"
>添加子栏目</el-button> >添加子栏目</el-button>
<el-button <el-button
@ -98,7 +111,7 @@ export default {
getList() { getList() {
this.loading = true; this.loading = true;
listCategory(this.queryParams).then(response => { listCategory(this.queryParams).then(response => {
console.log(response) console.log(response.data)
this.categoryList = response.data; this.categoryList = response.data;
this.loading = false; this.loading = false;
}); });
@ -108,15 +121,23 @@ export default {
handleQuery() { handleQuery() {
this.getList(); this.getList();
}, },
/** 重置按钮操作 */ /** 重置按钮操作 */
resetQuery() { resetQuery() {
this.resetForm("queryForm"); this.resetForm("queryForm");
this.handleQuery(); this.handleQuery();
}, },
/** 新增按钮操作 */ /** 新增按钮操作 */
handleAdd() { handleAdd() {
this.$router.push({path:'/category/categoryForm'}) this.$router.push({path:'/category/categoryForm',query:{catgLevel:1}})
}, },
/**添加子栏目*/
handleChildAdd(row){
this.$router.push({path:'/category/categoryForm',query:{catgLevel:row.catgLevel+1,parentId:row.id}})
},
/** 修改按钮操作 */ /** 修改按钮操作 */
handleUpdate(row) { handleUpdate(row) {