新增:目录自定义排序功能

master
Guo XIn 1 year ago
parent 9cb96f9dbf
commit 09b9a70e9f
  1. 2
      dbsql/update/update202308.sql
  2. 4
      shandan-common/src/main/java/com/keyware/shandan/common/entity/TreeVo.java
  3. 2
      shandan-common/src/main/java/com/keyware/shandan/common/util/TreeUtil.java
  4. 18
      shandan-system/src/main/java/com/keyware/shandan/bianmu/entity/DirectoryVo.java
  5. 1
      shandan-system/src/main/java/com/keyware/shandan/bianmu/utils/DirectoryUtil.java
  6. 1
      shandan-system/src/main/resources/mybatis/mapper/bianmu/DirectoryMapper.xml
  7. 16
      shandan-system/src/main/resources/static/js/business/directory/dirCommon.js

@ -0,0 +1,2 @@
alter table BIANMU.B_DIRECTORY add SORT integer;
comment on column BIANMU.B_DIRECTORY.SORT is '加载顺序';

@ -57,6 +57,10 @@ public class TreeVo implements Serializable {
* 选中状态
*/
private String checked = "0";
/**
* 加载顺序
*/
private int sort;
/**
* 节点原始数据
*/

@ -5,6 +5,7 @@ import org.springframework.lang.NonNull;
import org.springframework.lang.Nullable;
import java.text.Collator;
import java.util.Comparator;
import java.util.List;
import java.util.Locale;
import java.util.stream.Collectors;
@ -29,6 +30,7 @@ public class TreeUtil {
.filter(node -> (node.getParentId().equals(parentId)))
// 给子节点设置子节点
.peek(child -> child.setChildren(buildDirTree(nodes, child.getId())))
.sorted(Comparator.comparingInt(TreeVo::getSort))
.toList();
}

@ -130,21 +130,9 @@ public class DirectoryVo extends BaseEntity {
@OrderBy(isDesc = false)
private Date createTime;
/**
* 所属部门对象
*/
/*@TableField(exist = false)
private SysOrg org;*/
@TableField(exist = false)
private String modifyUserName;
/**
* 是否有子级
*/
/*@TableField(exist = false)
private Boolean hasChild;*/
/**
* 子级目录
*/
@ -157,6 +145,12 @@ public class DirectoryVo extends BaseEntity {
@TableField(exist = false)
private boolean applyChild;
/**
* 目录顺序
*/
@TableField(value = "SORT")
private Integer sort;
/**
* 创建人名称
*/

@ -29,6 +29,7 @@ public class DirectoryUtil {
tree.setType("DIRECTORY");
tree.setPath(dir.getDirectoryPath());
tree.setBasicData(dir);
tree.setSort(dir.getSort() == null ? Integer.MAX_VALUE : dir.getSort());
if (dir.getDirectoryType() == DirectoryType.FILE || dir.getDirectoryType() == DirectoryType.LINK_FILE) {
tree.setIconClass("dtree-icon-normal-file");
tree.setLast(true);

@ -14,6 +14,7 @@
<result column="OWNER" property="owner"/>
<result column="OWNER_ID" property="ownerId"/>
<result column="OWNER_TYPE" property="ownerType"/>
<result column="SORT" property="sort"/>
<result column="CREATE_USER" property="createUser"/>
<result column="CREATE_TIME" property="createTime"/>
<result column="MODIFY_USER" property="modifyUser"/>

@ -117,11 +117,15 @@ function openDirectoryEditLayer(data, callback, view) {
</div>
<a lay-submit lay-filter="directoryEditForm" id="directoryEditFormSubmit" style=""></a>
</div>
<div class="layui-inline" style="width: calc(100% - 30px); margin:15px 15px 0 15px">
<div class="layui-inline" style="width: calc(63% - 30px); margin:15px 15px 0 15px">
<label style="color: #555">目录创建人</label><span style="color: #000" >${data.createUserName || user.userName}</span>
<input type="hidden" name="createUserName" value="${data.createUserName || user.userName}" />
<input type="hidden" name="createUser" value="${data.createUser || user.userId}" />
</div>
<div class="layui-inline" style="width: calc(37% - 40px); margin:15px 15px 0 15px">
<label style="color: #555">目录顺序</label>
<input class="layui-input" type="text" name="sort" value="${data.sort}" style="width: 60px"/>
</div>
</div>
</div>`,
success: function () {
@ -166,7 +170,9 @@ function openDirectoryEditLayer(data, callback, view) {
applyChildCheckbox(isEdit);
},
yes: function (index) {
if(view){return;}
if (view) {
return;
}
saveDirectory(index, callback);
}
})
@ -178,6 +184,12 @@ function saveDirectory(index, callback) {
layer.alert('禁止上传超过自身涉密等级的文件,您的涉密等级为【' + DICT.getText('secret_level', user.secretLevel) + '】', {icon: 2})
return;
}
if (isNaN(parseInt(field.sort))) {
layer.alert('目录顺序只能为数字');
return;
}
// 转换数据类型
field.basicDir = field.basicDir === '1';
// 如果是基础数据目录,则自动为提交状态