edrp.cn的Blog

学习,需要交流,欢迎大家和我共同来学习C#,ASP.NET,MS SQL Server开发Web项目,欢迎大家和我交流

博客园 首页 新随笔 联系 订阅 管理

一:引用
import {getDeptTree} from "@/api/system/dept";
二:
{
label: "部门id",
prop: "deptId",
type: "dept",
},
更换为:
{
label: "所属部门",
prop: "deptId",
type: "tree",
multiple: true,
dicData: [],
props: {
label: "title"
},
slot: true,
rules: [{
required: true,
message: "请选择所属部门",
trigger: "click"
}]
},

三:onLoad中的getList下面加入如下代码:
getDeptTree(this.form.tenantId).then(res => {
const index = this.$refs.crud.findColumnIndex("deptId");
this.option.column[index].dicData = res.data.data;
});
四:模板中加入:
<template slot-scope="{row}"
slot="deptId">
<el-tag>{{row.deptName}}</el-tag>
</template>
五:rowSave(row, loading, done)和rowUpdate(row, index, loading, done) 方法中加入如下代码:
row.deptId = row.deptId.join(",");
六:
beforeOpen(done, type) {
if (["edit", "view"].includes(type)) {
getDetail(this.form.id).then(res => {
this.form = res.data.data;
});
增加如下代码:
beforeOpen(done, type) {
if (["edit", "view"].includes(type)) {
getDetail(this.form.id).then(res => {
this.form = res.data.data;
this.form.deptId = this.form.deptId.split(",");
this.form.deptId.forEach((ele, index) => {
this.form.deptId[index] = Number(ele);
});
});
七:export default {下面的return{中增加
init: {
deptTree: [],
},

后端:
一:VO
private String deptName;
二:Wraper
List<String> deptName = SysCache.getDeptNames(employee.getDeptId());
employeeVO.setDeptName(Func.join(deptName));
三:Controller
@GetMapping("/list")
@ApiOperationSupport(order = 2)
@ApiOperation(value = "分页", notes = "传入employee")
public R<IPage<EmployeeVO>> list(@ApiIgnore @RequestParam Map<String, Object> employee, Query query) {
QueryWrapper<EmployeeEntity> queryWrapper= Condition.getQueryWrapper(employee,EmployeeEntity.class);
IPage<EmployeeEntity> pages = employeeService.page(Condition.getPage(query), queryWrapper);
return R.data(EmployeeWrapper.build().pageVO(pages));
}

 

posted on 2019-11-22 10:28  edrp.cn  阅读(946)  评论(0编辑  收藏  举报