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