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 @@ ...@@ -3,7 +3,7 @@
"version": "0.1.0", "version": "0.1.0",
"private": true, "private": true,
"scripts": { "scripts": {
"test": "vue-cli-service serve --development", "test": "vue-cli-service serve --host 192.168.60.48 --development",
"serve": "vue-cli-service serve --production", "serve": "vue-cli-service serve --production",
"build": "vue-cli-service build --production" "build": "vue-cli-service build --production"
}, },
......
...@@ -7,6 +7,12 @@ export const getAuthenticationDetailApi = () => network({ ...@@ -7,6 +7,12 @@ export const getAuthenticationDetailApi = () => network({
// 获取供应商类型 // 获取供应商类型
export const getSupplierTypeApi = () => network({ export const getSupplierTypeApi = () => network({
url : "/category/list/tree", url: "/category/list/tree",
method : "post" method: "post",
}) headers : {
\ No newline at end of file isToken : false
},
data: {
name: ""
}
});
\ No newline at end of file
...@@ -14,15 +14,17 @@ ...@@ -14,15 +14,17 @@
<div class="title"> <div class="title">
<span>请选择经营类型</span> <span>请选择经营类型</span>
<el-input v-model="typeSearch" placeholder="请输入" @input="getTypeSearch()"></el-input> <el-input v-model="typeSearch" placeholder="请输入" @input="getTypeSearch()"></el-input>
<div class="typeList"> <div class="typeList" v-if="typeListShow && typeListSearch.length > 0">
<div class="typeRows"> <template v-for="item in typeListSearch">
<span class="typeTitle">外观</span> <template v-for="itemChild in item.children">
<span class="typeParent">1>2</span> <template v-for="itemChildThree in itemChild.children">
</div> <div class="typeRows" @click="getCatIdName(itemChildThree.name,itemChildThree.catId)">
<div class="typeRows"> <span class="typeTitle">{{itemChildThree.name}}</span>
<span class="typeTitle">外观</span> <span class="typeParent">{{item.name}}>{{itemChild.name}}</span>
<span class="typeParent">1>2</span>
</div> </div>
</template>
</template>
</template>
</div> </div>
</div> </div>
<div class="content"> <div class="content">
...@@ -340,9 +342,11 @@ ...@@ -340,9 +342,11 @@
timer: null, timer: null,
activeName: '', activeName: '',
typeList: [], typeList: [],
typeListSearch:[],
catIdName: '', catIdName: '',
filePlaceCodeList: '', filePlaceCodeList: '',
typeSearch:'', typeSearch: '',
typeListShow:false
}; };
}, },
computed: { computed: {
...@@ -387,7 +391,8 @@ ...@@ -387,7 +391,8 @@
}, 1000); }, 1000);
} }
let param = { let param = {
phone: this.form.phone phone: this.form.phone,
type:0
} }
checkUser(param).then(res => { checkUser(param).then(res => {
//if (res.code == 200) { //if (res.code == 200) {
...@@ -453,8 +458,8 @@ ...@@ -453,8 +458,8 @@
getCategoryList(param).then(res => { getCategoryList(param).then(res => {
if (res.code == 200) { if (res.code == 200) {
console.log(res) console.log(res)
this.typeList = res.data.data this.typeList = res.data
this.activeName = res.data.data[0].children[0].name this.activeName = res.data[0].children[0].name
console.log(this.typeList) console.log(this.typeList)
} }
}) })
...@@ -542,9 +547,12 @@ ...@@ -542,9 +547,12 @@
window.open(word, '_blank') window.open(word, '_blank')
}, },
//获取选中类型名称 //获取选中类型名称
getCatIdName(val) { getCatIdName(val, catId='') {
console.log(val) console.log(val)
this.catIdName = val this.catIdName = val
if (catId) {
this.ruleForm.catId = catId
}
}, },
//获取地区 //获取地区
addressListfn() { addressListfn() {
...@@ -605,7 +613,10 @@ ...@@ -605,7 +613,10 @@
} }
getCategoryList(param).then(res => { getCategoryList(param).then(res => {
if (res.code == 200) { if (res.code == 200) {
this.typeListShow = true
this.typeListSearch = res.data
} }
}) })
} }
}, },
...@@ -1153,18 +1164,22 @@ ...@@ -1153,18 +1164,22 @@
width: 212px; width: 212px;
box-sizing: border-box; box-sizing: border-box;
z-index: 9; z-index: 9;
display:none; height: 200px;
overflow-y: auto;
.typeRows { .typeRows {
padding: 4px 16px; padding: 4px 16px;
border-bottom: 1px solid #eeeeee; border-bottom: 1px solid #eeeeee;
display: flex; display: flex;
flex-wrap: wrap; flex-wrap: wrap;
cursor: pointer;
span { span {
width: 100%; width: 100%;
} }
/* /*
span:first-child { span:first-child {
margin-bottom: 2px; margin-bottom: 2px;
}*/ }*/
...@@ -1173,6 +1188,10 @@ ...@@ -1173,6 +1188,10 @@
color: #C0C4CC; color: #C0C4CC;
} }
} }
.typeRows:hover {
background: #eeeeee;
}
} }
} }
......
...@@ -87,7 +87,7 @@ ...@@ -87,7 +87,7 @@
</el-form-item> </el-form-item>
<el-form-item label="供应商类型选择:" prop="catId"> <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> </el-form-item>
</div> </div>
...@@ -141,9 +141,8 @@ export default { ...@@ -141,9 +141,8 @@ export default {
}, },
options: [], options: [],
props: { props: {
emitPath: false, value: "catId",
value : "catId", label: "name"
label : "name"
} }
}; };
}, },
...@@ -222,6 +221,10 @@ export default { ...@@ -222,6 +221,10 @@ export default {
flex: 1; flex: 1;
margin: 0px !important; margin: 0px !important;
.el-cascader {
width: 100%;
}
img { img {
width: 100%; width: 100%;
max-height: 200px; max-height: 200px;
......
...@@ -91,8 +91,8 @@ module.exports = defineConfig({ ...@@ -91,8 +91,8 @@ module.exports = defineConfig({
open: true, open: true,
proxy: { proxy: {
[process.env.VUE_APP_BASE_API]: { [process.env.VUE_APP_BASE_API]: {
target: `http://139.9.157.49:8088`, // target: `http://139.9.157.49:8088`,
// target: `http://192.168.60.172:8188`, target: `http://192.168.60.172:8188`,
changeOrigin: true, changeOrigin: true,
pathRewrite: { pathRewrite: {
['^' + process.env.VUE_APP_BASE_API]: '' ['^' + process.env.VUE_APP_BASE_API]: ''
......
package com.supServer.project.controller; package com.supServer.project.controller;
import com.supServer.framework.web.domain.AjaxResult; import com.supServer.framework.web.domain.AjaxResult;
import com.supServer.project.entity.BizCategory;
import com.supServer.project.entity.vo.BizCategoryVo; import com.supServer.project.entity.vo.BizCategoryVo;
import com.supServer.project.service.BizCategoryService; import com.supServer.project.service.BizCategoryService;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
...@@ -10,7 +9,6 @@ import org.springframework.web.bind.annotation.RequestBody; ...@@ -10,7 +9,6 @@ import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/** /**
* <p> * <p>
...@@ -31,8 +29,7 @@ public class BizCategoryController { ...@@ -31,8 +29,7 @@ public class BizCategoryController {
*/ */
@PostMapping("/list/tree") @PostMapping("/list/tree")
public AjaxResult list (@RequestBody BizCategoryVo vo) { public AjaxResult list (@RequestBody BizCategoryVo vo) {
AjaxResult ajaxResult = bizCategoryService.listTree(vo); return bizCategoryService.listTree(vo);
return AjaxResult.success(ajaxResult);
} }
} }
...@@ -5,6 +5,7 @@ import com.supServer.project.entity.vo.BizCategoryVo; ...@@ -5,6 +5,7 @@ import com.supServer.project.entity.vo.BizCategoryVo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
import java.math.BigInteger;
import java.util.List; import java.util.List;
@Mapper @Mapper
...@@ -12,4 +13,8 @@ public interface BizCategoryMapper { ...@@ -12,4 +13,8 @@ public interface BizCategoryMapper {
List<BizCategory> listTree(@Param("vo") BizCategoryVo vo); 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; 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.framework.web.domain.AjaxResult;
import com.supServer.project.entity.BizCategory; import com.supServer.project.entity.BizCategory;
import com.supServer.project.entity.vo.BizCategoryVo; import com.supServer.project.entity.vo.BizCategoryVo;
import com.supServer.project.mapper.BizCategoryMapper; import com.supServer.project.mapper.BizCategoryMapper;
import com.supServer.project.service.BizCategoryService; import com.supServer.project.service.BizCategoryService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
...@@ -22,18 +29,72 @@ public class BizCategoryServiceImpl implements BizCategoryService { ...@@ -22,18 +29,72 @@ public class BizCategoryServiceImpl implements BizCategoryService {
@Override @Override
public AjaxResult listTree(BizCategoryVo vo) { public AjaxResult listTree(BizCategoryVo vo) {
List<BizCategory> list=bizCategoryMapper.listTree(vo); List<BizCategory> res;
if (CollectionUtil.isEmpty(list)) { List<BizCategory> list = CollUtil.newArrayList();
return AjaxResult.success(list); 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)); TreeNodeConfig treeNodeConfig = new TreeNodeConfig();
return menu; // 自定义属性名 都要默认值的
}).collect(Collectors.toList()); treeNodeConfig.setIdKey("code");
return AjaxResult.success(level1Menus); 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 @@ ...@@ -31,4 +31,27 @@
</select> </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> </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