Commit 62e1277d authored by tyn's avatar tyn

Merge branch 'master' of http://47.105.106.177:66/root/sup-server

parents 96d529ad 8e5dc3fd
This diff is collapsed.
......@@ -3,7 +3,7 @@
"version": "0.1.0",
"private": true,
"scripts": {
"test": "vue-cli-service serve --development",
"test": "vue-cli-service serve --host 192.168.60.48 --development",
"serve": "vue-cli-service serve --production",
"build": "vue-cli-service build --production"
},
......
......@@ -7,6 +7,12 @@ export const getAuthenticationDetailApi = () => network({
// 获取供应商类型
export const getSupplierTypeApi = () => network({
url : "/category/list/tree",
method : "post"
})
\ No newline at end of file
url: "/category/list/tree",
method: "post",
headers : {
isToken : false
},
data: {
name: ""
}
});
\ No newline at end of file
......@@ -14,15 +14,17 @@
<div class="title">
<span>请选择经营类型</span>
<el-input v-model="typeSearch" placeholder="请输入" @input="getTypeSearch()"></el-input>
<div class="typeList">
<div class="typeRows">
<span class="typeTitle">外观</span>
<span class="typeParent">1>2</span>
</div>
<div class="typeRows">
<span class="typeTitle">外观</span>
<span class="typeParent">1>2</span>
</div>
<div class="typeList" v-if="typeListShow && typeListSearch.length > 0">
<template v-for="item in typeListSearch">
<template v-for="itemChild in item.children">
<template v-for="itemChildThree in itemChild.children">
<div class="typeRows" @click="getCatIdName(itemChildThree.name,itemChildThree.catId)">
<span class="typeTitle">{{itemChildThree.name}}</span>
<span class="typeParent">{{item.name}}>{{itemChild.name}}</span>
</div>
</template>
</template>
</template>
</div>
</div>
<div class="content">
......@@ -340,9 +342,11 @@
timer: null,
activeName: '',
typeList: [],
typeListSearch:[],
catIdName: '',
filePlaceCodeList: '',
typeSearch:'',
typeSearch: '',
typeListShow:false
};
},
computed: {
......@@ -387,7 +391,8 @@
}, 1000);
}
let param = {
phone: this.form.phone
phone: this.form.phone,
type:0
}
checkUser(param).then(res => {
//if (res.code == 200) {
......@@ -453,8 +458,8 @@
getCategoryList(param).then(res => {
if (res.code == 200) {
console.log(res)
this.typeList = res.data.data
this.activeName = res.data.data[0].children[0].name
this.typeList = res.data
this.activeName = res.data[0].children[0].name
console.log(this.typeList)
}
})
......@@ -542,9 +547,12 @@
window.open(word, '_blank')
},
//获取选中类型名称
getCatIdName(val) {
getCatIdName(val, catId='') {
console.log(val)
this.catIdName = val
if (catId) {
this.ruleForm.catId = catId
}
},
//获取地区
addressListfn() {
......@@ -605,7 +613,10 @@
}
getCategoryList(param).then(res => {
if (res.code == 200) {
this.typeListShow = true
this.typeListSearch = res.data
}
})
}
},
......@@ -1153,18 +1164,22 @@
width: 212px;
box-sizing: border-box;
z-index: 9;
display:none;
height: 200px;
overflow-y: auto;
.typeRows {
padding: 4px 16px;
border-bottom: 1px solid #eeeeee;
display: flex;
flex-wrap: wrap;
cursor: pointer;
span {
width: 100%;
}
/*
/*
span:first-child {
margin-bottom: 2px;
}*/
......@@ -1173,6 +1188,10 @@
color: #C0C4CC;
}
}
.typeRows:hover {
background: #eeeeee;
}
}
}
......
......@@ -87,7 +87,7 @@
</el-form-item>
<el-form-item label="供应商类型选择:" prop="catId">
<el-cascader v-model="form.catId" :options="options" disabled placeholder=""></el-cascader>
<el-cascader v-model="form.catId" :options="options" disabled placeholder="" :props="props"></el-cascader>
</el-form-item>
</div>
......@@ -141,9 +141,8 @@ export default {
},
options: [],
props: {
emitPath: false,
value : "catId",
label : "name"
value: "catId",
label: "name"
}
};
},
......@@ -222,6 +221,10 @@ export default {
flex: 1;
margin: 0px !important;
.el-cascader {
width: 100%;
}
img {
width: 100%;
max-height: 200px;
......
......@@ -91,8 +91,8 @@ module.exports = defineConfig({
open: true,
proxy: {
[process.env.VUE_APP_BASE_API]: {
target: `http://139.9.157.49:8088`,
// target: `http://192.168.60.172:8188`,
// target: `http://139.9.157.49:8088`,
target: `http://192.168.60.172:8188`,
changeOrigin: true,
pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: ''
......
package com.supServer.project.controller;
import com.supServer.framework.web.domain.AjaxResult;
import com.supServer.project.entity.BizCategory;
import com.supServer.project.entity.vo.BizCategoryVo;
import com.supServer.project.service.BizCategoryService;
import org.springframework.beans.factory.annotation.Autowired;
......@@ -10,7 +9,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* <p>
......@@ -31,8 +29,7 @@ public class BizCategoryController {
*/
@PostMapping("/list/tree")
public AjaxResult list (@RequestBody BizCategoryVo vo) {
AjaxResult ajaxResult = bizCategoryService.listTree(vo);
return AjaxResult.success(ajaxResult);
return bizCategoryService.listTree(vo);
}
}
......@@ -5,6 +5,7 @@ import com.supServer.project.entity.vo.BizCategoryVo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import java.math.BigInteger;
import java.util.List;
@Mapper
......@@ -12,4 +13,8 @@ public interface BizCategoryMapper {
List<BizCategory> listTree(@Param("vo") BizCategoryVo vo);
List<BizCategory> oneLevels(@Param("vo") BizCategoryVo vo);
List<BizCategory> twoLevels(@Param("vo") List<BigInteger> vo);
}
package com.supServer.project.service.impl;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.lang.tree.TreeNodeConfig;
import cn.hutool.core.lang.tree.TreeUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.supServer.framework.web.domain.AjaxResult;
import com.supServer.project.entity.BizCategory;
import com.supServer.project.entity.vo.BizCategoryVo;
import com.supServer.project.mapper.BizCategoryMapper;
import com.supServer.project.service.BizCategoryService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
......@@ -22,18 +29,72 @@ public class BizCategoryServiceImpl implements BizCategoryService {
@Override
public AjaxResult listTree(BizCategoryVo vo) {
List<BizCategory> list=bizCategoryMapper.listTree(vo);
if (CollectionUtil.isEmpty(list)) {
return AjaxResult.success(list);
List<BizCategory> res;
List<BizCategory> list = CollUtil.newArrayList();
if (ObjectUtil.isNull(vo) || StringUtils.isBlank(vo.getName())){
List<BizCategory> bizCategories = bizCategoryMapper.listTree(vo);
list.addAll(bizCategories);
}else {
//一级目录
List<BizCategory> oneLevels = bizCategoryMapper.oneLevels(vo);
if(CollUtil.isNotEmpty(oneLevels)){
list.addAll(oneLevels);
//一级目录id集合
List<BigInteger> oneCodes = oneLevels.stream().map(BizCategory::getCode).distinct().collect(Collectors.toList());
//根据一级目录id集合 查找二级目录
List<BizCategory> twoLevels = bizCategoryMapper.twoLevels(oneCodes);
if (CollUtil.isNotEmpty(twoLevels)){
list.addAll(twoLevels);
//二级目录id集合
List<BigInteger> twoCodes = twoLevels.stream().map(BizCategory::getCode).distinct().collect(Collectors.toList());
//三级目录
List<BizCategory> threeLevels = bizCategoryMapper.twoLevels(twoCodes);
if (CollUtil.isNotEmpty(threeLevels)) list.addAll(threeLevels);
}
}
}
// 2 组装成父子的树形结构
List<BizCategory> level1Menus = list.stream().filter(bizCategory ->
bizCategory.getParentCode().equals(BigInteger.ZERO)
).map((menu) -> {
menu.setChildren(getChildrens(menu, list));
return menu;
}).collect(Collectors.toList());
return AjaxResult.success(level1Menus);
//配置
TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
// 自定义属性名 都要默认值的
treeNodeConfig.setIdKey("code");
treeNodeConfig.setParentIdKey("parentCode");
treeNodeConfig.setWeightKey("level");
treeNodeConfig.setNameKey("name");
treeNodeConfig.setChildrenKey("children");
//转换器
List<Tree<String>> treeNodes = TreeUtil.build(list, "0", treeNodeConfig,
(treeNode, tree) -> {
tree.setId(treeNode.getCode().toString());
tree.setParentId(treeNode.getParentCode().toString());
tree.setWeight(treeNode.getLevel());
tree.setName(treeNode.getName());
tree.putExtra("showStatus",treeNode.getShowStatus());
tree.putExtra("catId",treeNode.getCatId());
tree.putExtra("sort",treeNode.getSort());
tree.putExtra("mark",treeNode.getMark());
tree.putExtra("userId",treeNode.getUserId());
tree.putExtra("createTime",treeNode.getCreateTime());
tree.putExtra("updateTime",treeNode.getUpdateTime());
tree.putExtra("userName",treeNode.getUserName());
});
String jsonStr = JSONUtil.toJsonStr(treeNodes);
JSONArray jsonArray = JSONUtil.parseArray(jsonStr);
res = JSONUtil.toList(jsonArray, BizCategory.class);
return AjaxResult.success(res);
// List<BizCategory> list=bizCategoryMapper.listTree(vo);
// if (CollectionUtil.isEmpty(list)) {
// return AjaxResult.success(list);
// }
// // 2 组装成父子的树形结构
// List<BizCategory> level1Menus = list.stream().filter(bizCategory ->
// bizCategory.getParentCode().equals(BigInteger.ZERO)
// ).map((menu) -> {
// menu.setChildren(getChildrens(menu, list));
// return menu;
// }).collect(Collectors.toList());
// return AjaxResult.success(level1Menus);
}
......
......@@ -31,4 +31,27 @@
</select>
<select id="oneLevels" parameterType="com.supServer.project.entity.vo.BizCategoryVo" resultMap="BizCategoryResult">
select bc.*
from biz_category bc
<where>
<if test="vo.name != null and vo.name != ''">
and bc.name like concat('%', #{vo.name}, '%')
</if>
and bc.show_status='1'
and bc.parent_code=0
</where>
</select>
<select id="twoLevels" parameterType="java.util.List" resultMap="BizCategoryResult">
select bc.*
from biz_category bc
where bc.parent_code in
<foreach collection="vo" index="index" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</select>
</mapper>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment