fix部门页面
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
package org.nl.modules.common.base;
|
package org.nl.modules.common.base;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
@@ -18,15 +19,14 @@ public class BaseDTO implements Serializable {
|
|||||||
|
|
||||||
private Long create_id;
|
private Long create_id;
|
||||||
|
|
||||||
|
|
||||||
private String update_optname;
|
private String update_optname;
|
||||||
|
|
||||||
private Long update_optid;
|
private Long update_optid;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date create_time;
|
private Date create_time;
|
||||||
|
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date update_time;
|
private Date update_time;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import com.fasterxml.jackson.annotation.JsonIgnore;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.nl.modules.common.base.BaseDTO;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
@@ -32,24 +33,25 @@ import java.util.Set;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class Dept implements Serializable {
|
public class Dept extends BaseDTO implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
private Long dept_id;
|
private Long dept_id;
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "排序")
|
@ApiModelProperty(value = "排序")
|
||||||
private Integer dept_sort;
|
private Integer dept_sort;
|
||||||
|
|
||||||
|
|
||||||
@NotBlank
|
@NotBlank
|
||||||
@ApiModelProperty(value = "部门名称")
|
@ApiModelProperty(value = "部门名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@ApiModelProperty(value = "是否启用")
|
@ApiModelProperty(value = "是否启用")
|
||||||
private Boolean is_used;
|
private String is_used;
|
||||||
|
|
||||||
@ApiModelProperty(value = "上级部门")
|
@ApiModelProperty(value = "上级部门")
|
||||||
private Long pid;
|
private Long pid;
|
||||||
|
|||||||
@@ -18,6 +18,7 @@ package org.nl.modules.system.domain;
|
|||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.nl.modules.common.base.BaseDTO;
|
||||||
|
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
@@ -29,7 +30,7 @@ import java.util.Date;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class User implements Serializable {
|
public class User extends BaseDTO implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
@ApiModelProperty(value = "ID", hidden = true)
|
@ApiModelProperty(value = "ID", hidden = true)
|
||||||
|
|||||||
@@ -15,14 +15,17 @@
|
|||||||
*/
|
*/
|
||||||
package org.nl.modules.system.domain.vo;
|
package org.nl.modules.system.domain.vo;
|
||||||
|
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
|
import org.nl.modules.common.base.BaseDTO;
|
||||||
import org.nl.modules.system.service.dto.MenuDto;
|
import org.nl.modules.system.service.dto.MenuDto;
|
||||||
|
|
||||||
import javax.validation.constraints.NotBlank;
|
import javax.validation.constraints.NotBlank;
|
||||||
import javax.validation.constraints.NotNull;
|
import javax.validation.constraints.NotNull;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -31,7 +34,7 @@ import java.util.List;
|
|||||||
*/
|
*/
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
public class DeptVo implements Serializable {
|
public class DeptVo extends BaseDTO implements Serializable {
|
||||||
|
|
||||||
|
|
||||||
private Long dept_id;
|
private Long dept_id;
|
||||||
@@ -39,13 +42,14 @@ public class DeptVo implements Serializable {
|
|||||||
@ApiModelProperty(value = "排序")
|
@ApiModelProperty(value = "排序")
|
||||||
private Integer dept_sort;
|
private Integer dept_sort;
|
||||||
|
|
||||||
|
|
||||||
@NotBlank
|
@NotBlank
|
||||||
@ApiModelProperty(value = "部门名称")
|
@ApiModelProperty(value = "部门名称")
|
||||||
private String name;
|
private String name;
|
||||||
|
|
||||||
@NotNull
|
@NotNull
|
||||||
@ApiModelProperty(value = "是否启用")
|
@ApiModelProperty(value = "是否启用")
|
||||||
private Boolean is_used;
|
private String is_used;
|
||||||
|
|
||||||
@ApiModelProperty(value = "上级部门")
|
@ApiModelProperty(value = "上级部门")
|
||||||
private Long pid;
|
private Long pid;
|
||||||
@@ -55,6 +59,7 @@ public class DeptVo implements Serializable {
|
|||||||
//前端显示
|
//前端显示
|
||||||
private Boolean hasChildren =Boolean.FALSE;
|
private Boolean hasChildren =Boolean.FALSE;
|
||||||
|
|
||||||
|
|
||||||
private List<DeptVo> children;
|
private List<DeptVo> children;
|
||||||
|
|
||||||
public void setSub_count(Integer sub_count) {
|
public void setSub_count(Integer sub_count) {
|
||||||
|
|||||||
@@ -36,7 +36,7 @@ public class DeptQueryCriteria{
|
|||||||
private String code;
|
private String code;
|
||||||
|
|
||||||
@Query
|
@Query
|
||||||
private Boolean is_used;
|
private String is_used;
|
||||||
|
|
||||||
@Query
|
@Query
|
||||||
private Long pid;
|
private Long pid;
|
||||||
|
|||||||
@@ -78,7 +78,7 @@ public class UserDetail implements Serializable {
|
|||||||
|
|
||||||
private String extuser_id;
|
private String extuser_id;
|
||||||
|
|
||||||
private Boolean is_used;
|
private String is_used;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ import cn.hutool.db.Entity;
|
|||||||
import com.alibaba.fastjson.JSON;
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.alibaba.fastjson.JSONArray;
|
import com.alibaba.fastjson.JSONArray;
|
||||||
import com.alibaba.fastjson.JSONObject;
|
import com.alibaba.fastjson.JSONObject;
|
||||||
|
import com.alibaba.fastjson.serializer.SerializerFeature;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.SneakyThrows;
|
import lombok.SneakyThrows;
|
||||||
import org.nl.modules.common.exception.BadRequestException;
|
import org.nl.modules.common.exception.BadRequestException;
|
||||||
@@ -143,7 +144,9 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
}
|
}
|
||||||
Dept dept = findById(resources.getDept_id());
|
Dept dept = findById(resources.getDept_id());
|
||||||
resources.setDept_id(dept.getDept_id());
|
resources.setDept_id(dept.getDept_id());
|
||||||
WQLObject.getWQLObject("sys_dept").update((JSONObject)JSON.toJSON(resources),"dept_id = '"+resources.getDept_id()+"'");
|
|
||||||
|
// WQLObject.getWQLObject("sys_dept").update((JSONObject)JSON.toJSON(resources),"dept_id = '"+resources.getDept_id()+"'");
|
||||||
|
WQLObject.getWQLObject("sys_dept").update(JSONObject.parseObject(JSON.toJSONString(resources)),"dept_id = '"+resources.getDept_id()+"'");
|
||||||
// 更新父节点中子节点数目
|
// 更新父节点中子节点数目
|
||||||
updateSubCnt(oldPid);
|
updateSubCnt(oldPid);
|
||||||
updateSubCnt(newPid);
|
updateSubCnt(newPid);
|
||||||
@@ -272,7 +275,7 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
public List<Long> getDeptChildren(List<Dept> deptList) {
|
public List<Long> getDeptChildren(List<Dept> deptList) {
|
||||||
List<Long> list = new ArrayList<>();
|
List<Long> list = new ArrayList<>();
|
||||||
deptList.forEach(dept -> {
|
deptList.forEach(dept -> {
|
||||||
if (dept != null && dept.getIs_used()) {
|
if (dept != null && "1".equals(dept.getIs_used())) {
|
||||||
List<Dept> depts = findByPid(dept.getDept_id());
|
List<Dept> depts = findByPid(dept.getDept_id());
|
||||||
if (deptList.size() != 0) {
|
if (deptList.size() != 0) {
|
||||||
list.addAll(getDeptChildren(depts));
|
list.addAll(getDeptChildren(depts));
|
||||||
|
|||||||
@@ -151,7 +151,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
onlineUserService.kickOutForUsername(resources.getUsername());
|
onlineUserService.kickOutForUsername(resources.getUsername());
|
||||||
}
|
}
|
||||||
resources.setPassword(SaSecureUtil.md5BySalt(resources.getPassword(), "salt"));
|
resources.setPassword(SaSecureUtil.md5BySalt(resources.getPassword(), "salt"));
|
||||||
WQLObject.getWQLObject("sys_user").update((JSONObject)JSON.toJSON(resources),"user_id ='"+resources.getUser_id()+"'");
|
WQLObject.getWQLObject("sys_user").update(JSONObject.parseObject(JSON.toJSONString(resources)),"user_id ='"+resources.getUser_id()+"'");
|
||||||
// 清除缓存
|
// 清除缓存
|
||||||
delCaches(user.getUser_id(), user.getUsername());
|
delCaches(user.getUser_id(), user.getUsername());
|
||||||
//更新部门用户
|
//更新部门用户
|
||||||
@@ -171,7 +171,7 @@ public class UserServiceImpl implements UserService {
|
|||||||
user.setPerson_name(resources.getPerson_name());
|
user.setPerson_name(resources.getPerson_name());
|
||||||
user.setPhone(resources.getPhone());
|
user.setPhone(resources.getPhone());
|
||||||
user.setGender(resources.getGender());
|
user.setGender(resources.getGender());
|
||||||
WQLObject.getWQLObject("sys_user").update((JSONObject)JSON.toJSON(resources),"user_id ='"+resources.getUser_id()+"'");
|
WQLObject.getWQLObject("sys_user").update(JSONObject.parseObject(JSON.toJSONString(resources)),"user_id ='"+resources.getUser_id()+"'");
|
||||||
// 清理缓存
|
// 清理缓存
|
||||||
delCaches(user.getUser_id(), user.getUsername());
|
delCaches(user.getUser_id(), user.getUsername());
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -62,6 +62,9 @@
|
|||||||
OPTION 输入.code <> ""
|
OPTION 输入.code <> ""
|
||||||
code = 输入.code
|
code = 输入.code
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
|
OPTION 输入.is_used <> ""
|
||||||
|
is_used = 输入.is_used
|
||||||
|
ENDOPTION
|
||||||
OPTION 输入.pidIsNull <> ""
|
OPTION 输入.pidIsNull <> ""
|
||||||
pid is null
|
pid is null
|
||||||
ENDOPTION
|
ENDOPTION
|
||||||
|
|||||||
@@ -14,7 +14,7 @@
|
|||||||
@keyup.enter.native="crud.toQuery"
|
@keyup.enter.native="crud.toQuery"
|
||||||
/>
|
/>
|
||||||
<el-select
|
<el-select
|
||||||
v-model="query.enabled"
|
v-model="query.is_used"
|
||||||
clearable
|
clearable
|
||||||
size="mini"
|
size="mini"
|
||||||
placeholder="状态"
|
placeholder="状态"
|
||||||
@@ -28,7 +28,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<crudOperation :permission="permission" />
|
<crudOperation :permission="permission" />
|
||||||
</div>
|
</div>
|
||||||
<!--表单组件-->
|
|
||||||
<el-dialog
|
<el-dialog
|
||||||
append-to-body
|
append-to-body
|
||||||
:close-on-click-modal="false"
|
:close-on-click-modal="false"
|
||||||
@@ -46,7 +45,7 @@
|
|||||||
</el-form-item>
|
</el-form-item>
|
||||||
<el-form-item label="部门排序" prop="deptSort">
|
<el-form-item label="部门排序" prop="deptSort">
|
||||||
<el-input-number
|
<el-input-number
|
||||||
v-model.number="form.deptSort"
|
v-model.number="form.dept_sort"
|
||||||
:min="0"
|
:min="0"
|
||||||
:max="999"
|
:max="999"
|
||||||
controls-position="right"
|
controls-position="right"
|
||||||
@@ -76,7 +75,8 @@
|
|||||||
:load-options="loadDepts"
|
:load-options="loadDepts"
|
||||||
:options="depts"
|
:options="depts"
|
||||||
style="width: 370px;"
|
style="width: 370px;"
|
||||||
placeholder="选择上级类目"
|
:normalizer="normalizer"
|
||||||
|
placeholder="选择部门类目"
|
||||||
/>
|
/>
|
||||||
</el-form-item>
|
</el-form-item>
|
||||||
</el-form>
|
</el-form>
|
||||||
@@ -101,23 +101,21 @@
|
|||||||
<el-table-column :selectable="checkboxT" type="selection" width="55" />
|
<el-table-column :selectable="checkboxT" type="selection" width="55" />
|
||||||
<!-- <el-table-column label="编码" prop="code" />-->
|
<!-- <el-table-column label="编码" prop="code" />-->
|
||||||
<el-table-column label="名称" prop="name" />
|
<el-table-column label="名称" prop="name" />
|
||||||
<el-table-column label="排序" prop="deptSort" />
|
<el-table-column label="排序" prop="dept_sort" />
|
||||||
<el-table-column label="状态" align="center" prop="enabled">
|
<el-table-column label="状态" align="center" prop="is_used">
|
||||||
<template slot-scope="scope">
|
<template slot-scope="scope">
|
||||||
<el-switch
|
<el-switch
|
||||||
v-model="scope.row.enabled"
|
v-model="scope.row.is_used"
|
||||||
:disabled="scope.row.id === 1"
|
:disabled="scope.row.id === 1"
|
||||||
active-color="#409EFF"
|
active-color="#409EFF"
|
||||||
inactive-color="#F56C6C"
|
inactive-color="#F56C6C"
|
||||||
|
active-value="1"
|
||||||
|
inactive-value="0"
|
||||||
@change="changeEnabled(scope.row, scope.row.enabled,)"
|
@change="changeEnabled(scope.row, scope.row.enabled,)"
|
||||||
/>
|
/>
|
||||||
</template>
|
</template>
|
||||||
</el-table-column>
|
</el-table-column>
|
||||||
<el-table-column prop="createTime" label="创建日期">
|
<el-table-column prop="create_time" label="创建日期" />
|
||||||
<template slot-scope="scope">
|
|
||||||
<span>{{ parseTime(scope.row.createTime) }}</span>
|
|
||||||
</template>
|
|
||||||
</el-table-column>
|
|
||||||
<el-table-column
|
<el-table-column
|
||||||
v-permission="['admin','dept:edit','dept:del']"
|
v-permission="['admin','dept:edit','dept:del']"
|
||||||
label="操作"
|
label="操作"
|
||||||
@@ -146,16 +144,15 @@ import CRUD, { crud, form, header, presenter } from '@crud/crud'
|
|||||||
import rrOperation from '@crud/RR.operation'
|
import rrOperation from '@crud/RR.operation'
|
||||||
import crudOperation from '@crud/CRUD.operation'
|
import crudOperation from '@crud/CRUD.operation'
|
||||||
import udOperation from '@crud/UD.operation'
|
import udOperation from '@crud/UD.operation'
|
||||||
import { getDeptvo } from '../../../api/system/dept'
|
|
||||||
|
|
||||||
const defaultForm = {
|
const defaultForm = {
|
||||||
id: null,
|
id: null,
|
||||||
code: null,
|
code: null,
|
||||||
name: null,
|
name: null,
|
||||||
isTop: '1',
|
isTop: '1',
|
||||||
subCount: 0,
|
sub_count: 0,
|
||||||
pid: null,
|
pid: null,
|
||||||
deptSort: 999,
|
dept_sort: 999,
|
||||||
enabled: 'true',
|
enabled: 'true',
|
||||||
extId: null,
|
extId: null,
|
||||||
versionId: null
|
versionId: null
|
||||||
@@ -189,8 +186,8 @@ export default {
|
|||||||
del: ['admin', 'dept:del']
|
del: ['admin', 'dept:del']
|
||||||
},
|
},
|
||||||
enabledTypeOptions: [
|
enabledTypeOptions: [
|
||||||
{ key: 'true', display_name: '正常' },
|
{ key: '1', display_name: '正常' },
|
||||||
{ key: 'false', display_name: '禁用' }
|
{ key: '0', display_name: '禁用' }
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@@ -235,8 +232,7 @@ export default {
|
|||||||
})
|
})
|
||||||
},
|
},
|
||||||
getDepts() {
|
getDepts() {
|
||||||
crudDept.getDepts({ enabled: true }).then(res => {
|
crudDept.getDeptvo({ is_used: '1' }).then(res => {
|
||||||
debugger
|
|
||||||
this.depts = res.content.map(function(obj) {
|
this.depts = res.content.map(function(obj) {
|
||||||
if (obj.hasChildren) {
|
if (obj.hasChildren) {
|
||||||
obj.children = null
|
obj.children = null
|
||||||
@@ -248,11 +244,9 @@ export default {
|
|||||||
// 获取弹窗内部门数据
|
// 获取弹窗内部门数据
|
||||||
loadDepts({ action, parentNode, callback }) {
|
loadDepts({ action, parentNode, callback }) {
|
||||||
if (action === LOAD_CHILDREN_OPTIONS) {
|
if (action === LOAD_CHILDREN_OPTIONS) {
|
||||||
crudDept.getDepts({ enabled: true, pid: parentNode.id }).then(res => {
|
crudDept.getDeptvo({ is_used: '1', pid: parentNode.dept_id }).then(res => {
|
||||||
parentNode.children = res.content.map(function(obj) {
|
parentNode.children = res.content.map(function(obj) {
|
||||||
if (obj.hasChildren) {
|
obj.children = null
|
||||||
obj.children = null
|
|
||||||
}
|
|
||||||
return obj
|
return obj
|
||||||
})
|
})
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@@ -294,6 +288,13 @@ export default {
|
|||||||
},
|
},
|
||||||
checkboxT(row, rowIndex) {
|
checkboxT(row, rowIndex) {
|
||||||
return row.id !== 1
|
return row.id !== 1
|
||||||
|
},
|
||||||
|
normalizer(node) {
|
||||||
|
return {
|
||||||
|
id: node.dept_id,
|
||||||
|
label: node.name,
|
||||||
|
children: node.children
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user