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