Merge branch 'master' of http://124.222.105.7:3000/dianliang/dl_site_system
This commit is contained in:
commit
433677db90
@ -43,11 +43,14 @@ public class BusiCategoryServiceImpl extends ServiceImpl<BusiCategoryMapper, Bus
|
||||
//查询全部栏目
|
||||
LambdaQueryWrapper<BusiCategory> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(DlBaseEntity::getDelFlag,0)
|
||||
.eq(BusiCategory::getTenantId, category.getTenantId())
|
||||
.orderByAsc(DlBaseEntity::getCreateTime);
|
||||
.eq(BusiCategory::getTenantId,category.getTenantId());
|
||||
if(StringUtils.isNotEmpty(category.getCatgType())){
|
||||
lambdaQueryWrapper.eq(BusiCategory::getCatgType,category.getCatgType());
|
||||
}
|
||||
if (!StringUtils.isEmpty(category.getCatgName())) {
|
||||
lambdaQueryWrapper.like(BusiCategory::getCatgName, category.getCatgName());
|
||||
}
|
||||
lambdaQueryWrapper.orderByDesc(BusiCategory::getSort);
|
||||
List<BusiCategory> list = list(lambdaQueryWrapper);
|
||||
return buildCategoryTree(list);
|
||||
}
|
||||
@ -171,7 +174,7 @@ public class BusiCategoryServiceImpl extends ServiceImpl<BusiCategoryMapper, Bus
|
||||
for (BusiCategory category : list) {
|
||||
BusiCategoryVO vo = new BusiCategoryVO();
|
||||
BeanUtils.copyProperties(category,vo);
|
||||
vo.setValue(category.getId());
|
||||
vo.setId(category.getId());
|
||||
vo.setLabel(category.getCatgName());
|
||||
idToNodeMap.put(vo.getId(), vo);
|
||||
}
|
||||
|
@ -19,12 +19,10 @@ import java.util.List;
|
||||
@Data
|
||||
public class BusiCategoryVO extends BusiCategory {
|
||||
|
||||
private String value;
|
||||
private String label;
|
||||
|
||||
/**
|
||||
* 子集
|
||||
*/
|
||||
private List<BusiCategory> children = new ArrayList<>();
|
||||
|
||||
private List<BusiCategoryVO> children = new ArrayList<>();
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
<template>
|
||||
<div class="app-container">
|
||||
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
|
||||
<el-form-item label="分类" prop="catgId">
|
||||
<treeselect style="width: 200px" v-model="queryParams.catgId" :options="catgOptions" :normalizer="normalizer" :noResultsText="'暂无数据'" placeholder="选择分类" />
|
||||
</el-form-item>
|
||||
<el-form-item label="产品名称" prop="title">
|
||||
<el-input
|
||||
v-model="queryParams.title"
|
||||
@ -234,13 +237,17 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCategory } from "@/api/busi/category";
|
||||
import { listProdNew, getProdNew, delProdNew, addProdNew,delProdRandom, updateProdNew,listRandomProd,saveRandom } from "@/api/busi/prod";
|
||||
import { addRelation } from "@/api/busi/relation";
|
||||
import selectAllUser from "@/views/system/user/selectAllUser";
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
|
||||
export default {
|
||||
name: "Prod",
|
||||
dicts: ['sys_yes_no'],
|
||||
components: { selectAllUser },
|
||||
components: { selectAllUser ,Treeselect},
|
||||
data() {
|
||||
return {
|
||||
// 弹出层标题
|
||||
@ -253,6 +260,8 @@ export default {
|
||||
selectOpen: false,
|
||||
// 遮罩层
|
||||
loading: true,
|
||||
//栏目分类
|
||||
catgOptions:[],
|
||||
|
||||
// 非单个禁用
|
||||
single: true,
|
||||
@ -351,9 +360,27 @@ export default {
|
||||
break;
|
||||
}
|
||||
},
|
||||
/** 转换部门数据结构 */
|
||||
normalizer(node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
}
|
||||
return {
|
||||
id: node.id,
|
||||
label: node.label,
|
||||
children: node.children
|
||||
};
|
||||
},
|
||||
/** 查询产品、文章列表 */
|
||||
getList() {
|
||||
this.loading = true;
|
||||
//查产品栏目
|
||||
listCategory({catgType:"cp"}).then(response => {
|
||||
response.data.map((item)=>{
|
||||
item.parentId=0
|
||||
})
|
||||
this.catgOptions = response.data
|
||||
});
|
||||
listProdNew(this.queryParams).then(response => {
|
||||
this.prodList = response.data.records;
|
||||
this.total = response.data.total;
|
||||
|
@ -18,7 +18,7 @@
|
||||
<el-col :span="10">
|
||||
<el-form-item label="所属分类" prop="catgId">
|
||||
<div class="dl-flex-column">
|
||||
<el-input v-model="form.catgId" placeholder="请输入产品名称"/>
|
||||
<treeselect style="width: 200px" v-model="form.catgId" :options="catgOptions" :normalizer="normalizer" :noResultsText="'暂无数据'" placeholder="请选择产品分类" />
|
||||
<div class="dl-add-catg">添加产品分类</div>
|
||||
</div>
|
||||
</el-form-item>
|
||||
@ -88,14 +88,19 @@
|
||||
</template>
|
||||
|
||||
<script>
|
||||
import { listCategory } from "@/api/busi/category";
|
||||
import { listProdNew, getProdNew, delProdNew,getMaxSort, addProdNew, updateProdNew } from '@/api/busi/prod'
|
||||
|
||||
import Treeselect from "@riophae/vue-treeselect";
|
||||
import "@riophae/vue-treeselect/dist/vue-treeselect.css";
|
||||
export default {
|
||||
name: 'prodForm',
|
||||
components: { Treeselect},
|
||||
data() {
|
||||
return {
|
||||
//光标位置--简介
|
||||
cursorPos: null,
|
||||
//栏目分类
|
||||
catgOptions:[],
|
||||
// 表单参数
|
||||
form: {
|
||||
id: null,
|
||||
@ -142,23 +147,52 @@ export default {
|
||||
}
|
||||
},
|
||||
mounted() {
|
||||
this.initCatg()
|
||||
if(this.$route.query.id){
|
||||
if(this.$route.query.similar){
|
||||
//添加类似
|
||||
this.getProdInfo(this.$route.query.id,this.$route.query.similar)
|
||||
}else{
|
||||
//修改
|
||||
this.getProdInfo(this.$route.query.id)
|
||||
}
|
||||
}else{
|
||||
this.initData()
|
||||
}
|
||||
},
|
||||
methods: {
|
||||
initCatg(){
|
||||
//查产品栏目
|
||||
listCategory({catgType:"cp"}).then(response => {
|
||||
response.data.map((item)=>{
|
||||
item.parentId=0
|
||||
})
|
||||
this.catgOptions = response.data
|
||||
});
|
||||
},
|
||||
/** 转换部门数据结构 */
|
||||
normalizer(node) {
|
||||
if (node.children && !node.children.length) {
|
||||
delete node.children;
|
||||
}
|
||||
return {
|
||||
id: node.id,
|
||||
label: node.label,
|
||||
children: node.children
|
||||
};
|
||||
},
|
||||
initData(){
|
||||
getMaxSort({}).then(response => {
|
||||
this.form.sort = response.data
|
||||
})
|
||||
},
|
||||
getProdInfo(id){
|
||||
getProdInfo(id,similar){
|
||||
getProdNew(id).then(response => {
|
||||
this.form= response.data
|
||||
if(similar){
|
||||
this.form.id=null
|
||||
this.initData()
|
||||
}
|
||||
})
|
||||
},
|
||||
/**
|
||||
@ -189,6 +223,7 @@ export default {
|
||||
},
|
||||
/** 暂存 */
|
||||
saveTmp(){
|
||||
this.form.ifPublic=0
|
||||
if (this.form.id != null) {
|
||||
updateProdNew(this.form).then(response => {
|
||||
this.$modal.msgSuccess('修改成功')
|
||||
@ -219,6 +254,9 @@ export default {
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
/deep/.vue-treeselect__input{
|
||||
vertical-align: middle !important;
|
||||
}
|
||||
.dl-add-catg {
|
||||
cursor: pointer;
|
||||
width: 130px;
|
||||
|
@ -101,6 +101,7 @@ export default {
|
||||
initData(){
|
||||
listDept().then(response => {
|
||||
this.deptOptions = this.handleTree(response.data, "deptId");
|
||||
console.log(this.deptOptions,"de")
|
||||
});
|
||||
},
|
||||
/** 转换部门数据结构 */
|
||||
|
Loading…
Reference in New Issue
Block a user