Browse Source

完成个人空间和目录管理

wukai 2 năm trước cách đây
mục cha
commit
fae3839696
23 tập tin đã thay đổi với 905 bổ sung861 xóa
  1. 29 0
      lzga-api/lzga-api-system/src/main/java/com/jjt/system/api/RemoteConfigService.java
  2. 27 0
      lzga-api/lzga-api-system/src/main/java/com/jjt/system/api/factory/RemoteConfigFallbackFactory.java
  3. 6 11
      lzga-api/lzga-api-system/src/main/java/com/jjt/system/api/factory/RemoteLogFallbackFactory.java
  4. 6 11
      lzga-api/lzga-api-system/src/main/java/com/jjt/system/api/factory/RemoteUserFallbackFactory.java
  5. 2 0
      lzga-api/lzga-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports
  6. 68 21
      lzga-modules/lzga-doc/src/main/java/com/jjt/doc/controller/DocDirController.java
  7. 1 1
      lzga-modules/lzga-doc/src/main/java/com/jjt/doc/controller/DocInfoDirController.java
  8. 14 0
      lzga-modules/lzga-doc/src/main/java/com/jjt/doc/controller/DocSpaceController.java
  9. 45 58
      lzga-modules/lzga-doc/src/main/java/com/jjt/doc/domain/DocDir.java
  10. 32 20
      lzga-modules/lzga-doc/src/main/java/com/jjt/doc/domain/DocInfoDir.java
  11. 1 1
      lzga-modules/lzga-doc/src/main/java/com/jjt/doc/mapper/DocDirMapper.java
  12. 1 1
      lzga-modules/lzga-doc/src/main/java/com/jjt/doc/mapper/DocInfoDirMapper.java
  13. 18 10
      lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/IDocDirService.java
  14. 1 1
      lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/IDocInfoDirService.java
  15. 29 15
      lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/impl/DocDirServiceImpl.java
  16. 1 1
      lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/impl/DocInfoDirServiceImpl.java
  17. 1 8
      lzga-modules/lzga-doc/src/main/resources/mapper/doc/DocDirMapper.xml
  18. 5 3
      lzga-modules/lzga-doc/src/main/resources/mapper/doc/DocInfoDirMapper.xml
  19. 7 0
      lzga-ui/src/api/doc/dir.js
  20. 8 0
      lzga-ui/src/api/doc/space.js
  21. 194 313
      lzga-ui/src/views/doc/dir/index.vue
  22. 217 160
      lzga-ui/src/views/doc/expand/index.vue
  23. 192 226
      lzga-ui/src/views/system/dept/index.vue

+ 29 - 0
lzga-api/lzga-api-system/src/main/java/com/jjt/system/api/RemoteConfigService.java

@@ -0,0 +1,29 @@
+package com.jjt.system.api;
+
+import com.jjt.common.core.constant.SecurityConstants;
+import com.jjt.common.core.constant.ServiceNameConstants;
+import com.jjt.common.core.domain.R;
+import com.jjt.system.api.domain.SysUser;
+import com.jjt.system.api.factory.RemoteConfigFallbackFactory;
+import com.jjt.system.api.factory.RemoteUserFallbackFactory;
+import com.jjt.system.api.model.LoginUser;
+import org.springframework.cloud.openfeign.FeignClient;
+import org.springframework.web.bind.annotation.*;
+
+/**
+ * 用户服务
+ *
+ * @author ruoyi
+ */
+@FeignClient(contextId = "remoteConfigService", value = ServiceNameConstants.SYSTEM_SERVICE, fallbackFactory = RemoteConfigFallbackFactory.class)
+public interface RemoteConfigService {
+    /**
+     * 通过用户名查询用户信息
+     *
+     * @param configKey key
+     * @param source    请求来源
+     * @return 结果
+     */
+    @GetMapping("/config/configKey/{configKey}")
+    public R<String> selectConfigByKey(@PathVariable("configKey") String configKey, @RequestHeader(SecurityConstants.FROM_SOURCE) String source);
+}

+ 27 - 0
lzga-api/lzga-api-system/src/main/java/com/jjt/system/api/factory/RemoteConfigFallbackFactory.java

@@ -0,0 +1,27 @@
+package com.jjt.system.api.factory;
+
+import com.jjt.common.core.domain.R;
+import com.jjt.system.api.RemoteConfigService;
+import com.jjt.system.api.RemoteUserService;
+import com.jjt.system.api.domain.SysUser;
+import com.jjt.system.api.model.LoginUser;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.springframework.cloud.openfeign.FallbackFactory;
+import org.springframework.stereotype.Component;
+
+/**
+ * 用户服务降级处理
+ *
+ * @author ruoyi
+ */
+@Component
+public class RemoteConfigFallbackFactory implements FallbackFactory<RemoteConfigService> {
+    private static final Logger log = LoggerFactory.getLogger(RemoteConfigFallbackFactory.class);
+
+    @Override
+    public RemoteConfigService create(Throwable throwable) {
+        log.error("用户服务调用失败:{}", throwable.getMessage());
+        return (configKey, source) -> R.fail("获取用户失败:" + throwable.getMessage());
+    }
+}

+ 6 - 11
lzga-api/lzga-api-system/src/main/java/com/jjt/system/api/factory/RemoteLogFallbackFactory.java

@@ -11,29 +11,24 @@ import com.jjt.system.api.domain.SysOperLog;
 
 /**
  * 日志服务降级处理
- * 
+ *
  * @author ruoyi
  */
 @Component
-public class RemoteLogFallbackFactory implements FallbackFactory<RemoteLogService>
-{
+public class RemoteLogFallbackFactory implements FallbackFactory<RemoteLogService> {
     private static final Logger log = LoggerFactory.getLogger(RemoteLogFallbackFactory.class);
 
     @Override
-    public RemoteLogService create(Throwable throwable)
-    {
+    public RemoteLogService create(Throwable throwable) {
         log.error("日志服务调用失败:{}", throwable.getMessage());
-        return new RemoteLogService()
-        {
+        return new RemoteLogService() {
             @Override
-            public R<Boolean> saveLog(SysOperLog sysOperLog, String source)
-            {
+            public R<Boolean> saveLog(SysOperLog sysOperLog, String source) {
                 return null;
             }
 
             @Override
-            public R<Boolean> saveLogininfor(SysLogininfor sysLogininfor, String source)
-            {
+            public R<Boolean> saveLogininfor(SysLogininfor sysLogininfor, String source) {
                 return null;
             }
         };

+ 6 - 11
lzga-api/lzga-api-system/src/main/java/com/jjt/system/api/factory/RemoteUserFallbackFactory.java

@@ -11,29 +11,24 @@ import com.jjt.system.api.model.LoginUser;
 
 /**
  * 用户服务降级处理
- * 
+ *
  * @author ruoyi
  */
 @Component
-public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserService>
-{
+public class RemoteUserFallbackFactory implements FallbackFactory<RemoteUserService> {
     private static final Logger log = LoggerFactory.getLogger(RemoteUserFallbackFactory.class);
 
     @Override
-    public RemoteUserService create(Throwable throwable)
-    {
+    public RemoteUserService create(Throwable throwable) {
         log.error("用户服务调用失败:{}", throwable.getMessage());
-        return new RemoteUserService()
-        {
+        return new RemoteUserService() {
             @Override
-            public R<LoginUser> getUserInfo(String username, String source)
-            {
+            public R<LoginUser> getUserInfo(String username, String source) {
                 return R.fail("获取用户失败:" + throwable.getMessage());
             }
 
             @Override
-            public R<Boolean> registerUserInfo(SysUser sysUser, String source)
-            {
+            public R<Boolean> registerUserInfo(SysUser sysUser, String source) {
                 return R.fail("注册用户失败:" + throwable.getMessage());
             }
         };

+ 2 - 0
lzga-api/lzga-api-system/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports

@@ -1,4 +1,6 @@
 com.jjt.system.api.factory.RemoteUserFallbackFactory
 com.jjt.system.api.factory.RemoteLogFallbackFactory
 com.jjt.system.api.factory.RemoteFileFallbackFactory
+com.jjt.system.api.factory.RemoteDocSpaceFallbackFactory
+com.jjt.system.api.factory.RemoteConfigFallbackFactory
 com.jjt.system.api.factory.RemoteActualDataNodesFallbackFactory

+ 68 - 21
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/controller/DocDirController.java

@@ -1,9 +1,16 @@
 package com.jjt.doc.controller;
 
+import java.math.BigDecimal;
 import java.util.List;
 import java.io.IOException;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
+
+import com.jjt.common.core.constant.SecurityConstants;
+import com.jjt.common.security.utils.SecurityUtils;
+import com.jjt.doc.domain.DocSpace;
+import com.jjt.doc.service.IDocSpaceService;
+import com.jjt.system.api.RemoteConfigService;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
@@ -20,31 +27,70 @@ import com.jjt.doc.service.IDocDirService;
 import com.jjt.common.core.web.controller.BaseController;
 import com.jjt.common.core.web.domain.AjaxResult;
 import com.jjt.common.core.utils.poi.ExcelUtil;
-import com.jjt.common.core.web.page.TableDataInfo;
 
 /**
  * 目录信息Controller
- * 
+ *
  * @author wukai
- * @date 2023-03-27
+ * @date 2023-04-12
  */
 @RestController
 @RequestMapping("/dir")
-public class DocDirController extends BaseController
-{
+public class DocDirController extends BaseController {
     @Resource
     private IDocDirService docDirService;
+    @Resource
+    private IDocSpaceService docSpaceService;
+    @Resource
+    private RemoteConfigService remoteConfigService;
 
     /**
      * 查询目录信息列表
      */
     @RequiresPermissions("doc:dir:list")
     @GetMapping("/list")
-    public TableDataInfo list(DocDir docDir)
-    {
-        startPage();
+    public AjaxResult list(DocDir docDir) {
+        List<DocDir> list = docDirService.selectDocDirList(docDir);
+        return success(list);
+    }
+
+    /**
+     * 查询个人空间的目录
+     */
+    @RequiresPermissions("doc:dir:list")
+    @GetMapping("/list/personal")
+    public AjaxResult personalList() {
+        //1.先查询个人空间,如果没有则创建
+        DocSpace docSpace = new DocSpace();
+        docSpace.setOwner(SecurityUtils.getUserId());
+        docSpace.setSpaceType("3");
+        List<DocSpace> spaceList = docSpaceService.selectDocSpaceList(docSpace);
+        if (spaceList.size() == 0) {
+            //初始化用户空间
+            //个人空间
+            docSpace.setSpaceType("3");
+            docSpace.setOwner(SecurityUtils.getUserId());
+            docSpace.setSpaceName("\"" + SecurityUtils.getLoginUser().getSysUser().getNickName() + "\"的个人空间");
+            String defaultCap = remoteConfigService.selectConfigByKey("user.default.cap", SecurityConstants.INNER).getData();
+            BigDecimal cap = new BigDecimal(defaultCap);
+            docSpace.setSpaceCap(cap);
+            docSpace.setCreateBy(SecurityUtils.getUsername());
+            docSpaceService.insertDocSpace(docSpace);
+        } else {
+            docSpace = spaceList.get(0);
+        }
+        //2.查询顶层目录,如果没有则创建
+        DocDir docDir = new DocDir();
+        docDir.setSpaceId(docSpace.getSpaceId());
         List<DocDir> list = docDirService.selectDocDirList(docDir);
-        return getDataTable(list);
+        if (list.size() == 0) {
+            docDir.setDirName(docSpace.getSpaceName());
+            docDir.setParentId(0L);
+            docDirService.insertDocDir(docDir);
+
+            list = docDirService.selectDocDirList(docDir);
+        }
+        return success(list);
     }
 
     /**
@@ -53,8 +99,7 @@ public class DocDirController extends BaseController
     @RequiresPermissions("doc:dir:export")
     @Log(title = "目录信息", businessType = BusinessType.EXPORT)
     @PostMapping("/export")
-    public void export(HttpServletResponse response, DocDir docDir)
-    {
+    public void export(HttpServletResponse response, DocDir docDir) {
         List<DocDir> list = docDirService.selectDocDirList(docDir);
         ExcelUtil<DocDir> util = new ExcelUtil<DocDir>(DocDir.class);
         util.exportExcel(response, list, "目录信息数据");
@@ -65,8 +110,7 @@ public class DocDirController extends BaseController
      */
     @RequiresPermissions("doc:dir:query")
     @GetMapping(value = "/{dirId}")
-    public AjaxResult getInfo(@PathVariable("dirId") Long dirId)
-    {
+    public AjaxResult getInfo(@PathVariable("dirId") Long dirId) {
         return success(docDirService.selectDocDirByDirId(dirId));
     }
 
@@ -76,8 +120,7 @@ public class DocDirController extends BaseController
     @RequiresPermissions("doc:dir:add")
     @Log(title = "目录信息", businessType = BusinessType.INSERT)
     @PostMapping
-    public AjaxResult add(@RequestBody DocDir docDir)
-    {
+    public AjaxResult add(@RequestBody DocDir docDir) {
         return toAjax(docDirService.insertDocDir(docDir));
     }
 
@@ -87,8 +130,7 @@ public class DocDirController extends BaseController
     @RequiresPermissions("doc:dir:edit")
     @Log(title = "目录信息", businessType = BusinessType.UPDATE)
     @PutMapping
-    public AjaxResult edit(@RequestBody DocDir docDir)
-    {
+    public AjaxResult edit(@RequestBody DocDir docDir) {
         return toAjax(docDirService.updateDocDir(docDir));
     }
 
@@ -97,9 +139,14 @@ public class DocDirController extends BaseController
      */
     @RequiresPermissions("doc:dir:remove")
     @Log(title = "目录信息", businessType = BusinessType.DELETE)
-	@DeleteMapping("/{dirIds}")
-    public AjaxResult remove(@PathVariable Long[] dirIds)
-    {
-        return toAjax(docDirService.deleteDocDirByDirIds(dirIds));
+    @DeleteMapping("/{dirId}")
+    public AjaxResult remove(@PathVariable Long dirId) {
+        if (docDirService.hasChildByDirId(dirId)) {
+            return warn("存在下级目录,不允许删除");
+        }
+//        if (docDirService.checkDeptExistUser(deptId)) {
+//            return warn("目录不为空,不允许删除");
+//        }
+        return toAjax(docDirService.deleteDocDirByDirId(dirId));
     }
 }

+ 1 - 1
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/controller/DocInfoDirController.java

@@ -26,7 +26,7 @@ import com.jjt.common.core.web.page.TableDataInfo;
  * 文档目录关系Controller
  * 
  * @author wukai
- * @date 2023-03-27
+ * @date 2023-04-12
  */
 @RestController
 @RequestMapping("/infoDir")

+ 14 - 0
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/controller/DocSpaceController.java

@@ -6,6 +6,7 @@ import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
 
 import com.jjt.common.security.annotation.InnerAuth;
+import com.jjt.common.security.utils.SecurityUtils;
 import org.springframework.web.bind.annotation.GetMapping;
 import org.springframework.web.bind.annotation.PostMapping;
 import org.springframework.web.bind.annotation.PutMapping;
@@ -69,6 +70,19 @@ public class DocSpaceController extends BaseController {
     }
 
     /**
+     * 获取当前登录用户空间详细信息
+     */
+    @GetMapping(value = "/personal")
+    public AjaxResult getPersonalSpace() {
+        Long uid = SecurityUtils.getUserId();
+        DocSpace docSpace = new DocSpace();
+        docSpace.setOwner(uid);
+        docSpace.setSpaceType("3");
+        List<DocSpace> list = docSpaceService.selectDocSpaceList(docSpace);
+        return success(list.get(0));
+    }
+
+    /**
      * 新增存储空间
      */
     @RequiresPermissions("doc:space:add")

+ 45 - 58
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/domain/DocDir.java

@@ -3,110 +3,97 @@ package com.jjt.doc.domain;
 import org.apache.commons.lang3.builder.ToStringBuilder;
 import org.apache.commons.lang3.builder.ToStringStyle;
 import com.jjt.common.core.annotation.Excel;
-import com.jjt.common.core.web.domain.BaseEntity;
+import com.jjt.common.core.web.domain.TreeEntity;
 
 /**
  * 目录信息对象 doc_dir
- * 
+ *
  * @author wukai
- * @date 2023-03-27
+ * @date 2023-04-12
  */
-public class DocDir extends BaseEntity
-{
+public class DocDir extends TreeEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 目录ID */
+    /**
+     * 目录ID
+     */
     private Long dirId;
 
-    /** 空间ID */
-    @Excel(name = "空间ID")
+    /**
+     * 空间ID
+     */
     private Long spaceId;
 
-    /** 父目录ID */
-    @Excel(name = "父目录ID")
-    private Long parentId;
-
-    /** 目录名称 */
+    /**
+     * 目录名称
+     */
     @Excel(name = "目录名称")
     private String dirName;
 
-    /** 目录路径 */
-    @Excel(name = "目录路径")
+    /**
+     * 目录路径
+     */
     private String dirPath;
 
-    /** 逻辑删除标志;1/非1 */
-    @Excel(name = "逻辑删除标志;1/非1")
+    /**
+     * 逻辑删除标志;1/非1
+     */
     private String isDel;
 
-    public void setDirId(Long dirId) 
-    {
+    public void setDirId(Long dirId) {
         this.dirId = dirId;
     }
 
-    public Long getDirId() 
-    {
+    public Long getDirId() {
         return dirId;
     }
-    public void setSpaceId(Long spaceId) 
-    {
+
+    public void setSpaceId(Long spaceId) {
         this.spaceId = spaceId;
     }
 
-    public Long getSpaceId() 
-    {
+    public Long getSpaceId() {
         return spaceId;
     }
-    public void setParentId(Long parentId) 
-    {
-        this.parentId = parentId;
-    }
 
-    public Long getParentId() 
-    {
-        return parentId;
-    }
-    public void setDirName(String dirName) 
-    {
+    public void setDirName(String dirName) {
         this.dirName = dirName;
     }
 
-    public String getDirName() 
-    {
+    public String getDirName() {
         return dirName;
     }
-    public void setDirPath(String dirPath) 
-    {
+
+    public void setDirPath(String dirPath) {
         this.dirPath = dirPath;
     }
 
-    public String getDirPath() 
-    {
+    public String getDirPath() {
         return dirPath;
     }
-    public void setIsDel(String isDel) 
-    {
+
+    public void setIsDel(String isDel) {
         this.isDel = isDel;
     }
 
-    public String getIsDel() 
-    {
+    public String getIsDel() {
         return isDel;
     }
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("dirId", getDirId())
-            .append("spaceId", getSpaceId())
-            .append("parentId", getParentId())
-            .append("dirName", getDirName())
-            .append("dirPath", getDirPath())
-            .append("createBy", getCreateBy())
-            .append("createTime", getCreateTime())
-            .append("updateBy", getUpdateBy())
-            .append("updateTime", getUpdateTime())
-            .append("remark", getRemark())
-            .append("isDel", getIsDel())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("dirId", getDirId())
+                .append("spaceId", getSpaceId())
+                .append("parentId", getParentId())
+                .append("dirName", getDirName())
+                .append("dirPath", getDirPath())
+                .append("createBy", getCreateBy())
+                .append("createTime", getCreateTime())
+                .append("updateBy", getUpdateBy())
+                .append("updateTime", getUpdateTime())
+                .append("remark", getRemark())
+                .append("isDel", getIsDel())
+                .toString();
     }
 }

+ 32 - 20
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/domain/DocInfoDir.java

@@ -7,46 +7,58 @@ import com.jjt.common.core.web.domain.BaseEntity;
 
 /**
  * 文档目录关系对象 doc_info_dir
- * 
+ *
  * @author wukai
- * @date 2023-03-27
+ * @date 2023-04-12
  */
-public class DocInfoDir extends BaseEntity
-{
+public class DocInfoDir extends BaseEntity {
     private static final long serialVersionUID = 1L;
 
-    /** 文档ID */
-    @Excel(name = "文档ID")
+    /**
+     * 文档ID
+     */
     private Long docId;
 
-    /** 目录ID */
-    @Excel(name = "目录ID")
+    /**
+     * 文档年份
+     */
+    private Long docYear;
+
+    /**
+     * 目录ID
+     */
     private Long dirId;
 
-    public void setDocId(Long docId) 
-    {
+    public void setDocId(Long docId) {
         this.docId = docId;
     }
 
-    public Long getDocId() 
-    {
+    public Long getDocId() {
         return docId;
     }
-    public void setDirId(Long dirId) 
-    {
+
+    public void setDocYear(Long docYear) {
+        this.docYear = docYear;
+    }
+
+    public Long getDocYear() {
+        return docYear;
+    }
+
+    public void setDirId(Long dirId) {
         this.dirId = dirId;
     }
 
-    public Long getDirId() 
-    {
+    public Long getDirId() {
         return dirId;
     }
 
     @Override
     public String toString() {
-        return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
-            .append("docId", getDocId())
-            .append("dirId", getDirId())
-            .toString();
+        return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
+                .append("docId", getDocId())
+                .append("docYear", getDocYear())
+                .append("dirId", getDirId())
+                .toString();
     }
 }

+ 1 - 1
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/mapper/DocDirMapper.java

@@ -7,7 +7,7 @@ import com.jjt.doc.domain.DocDir;
  * 目录信息Mapper接口
  * 
  * @author wukai
- * @date 2023-03-27
+ * @date 2023-04-12
  */
 public interface DocDirMapper 
 {

+ 1 - 1
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/mapper/DocInfoDirMapper.java

@@ -7,7 +7,7 @@ import com.jjt.doc.domain.DocInfoDir;
  * 文档目录关系Mapper接口
  * 
  * @author wukai
- * @date 2023-03-27
+ * @date 2023-04-12
  */
 public interface DocInfoDirMapper 
 {

+ 18 - 10
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/IDocDirService.java

@@ -1,19 +1,19 @@
 package com.jjt.doc.service;
 
 import java.util.List;
+
 import com.jjt.doc.domain.DocDir;
 
 /**
  * 目录信息Service接口
- * 
+ *
  * @author wukai
- * @date 2023-03-27
+ * @date 2023-04-12
  */
-public interface IDocDirService 
-{
+public interface IDocDirService {
     /**
      * 查询目录信息
-     * 
+     *
      * @param dirId 目录信息主键
      * @return 目录信息
      */
@@ -21,7 +21,7 @@ public interface IDocDirService
 
     /**
      * 查询目录信息列表
-     * 
+     *
      * @param docDir 目录信息
      * @return 目录信息集合
      */
@@ -29,7 +29,7 @@ public interface IDocDirService
 
     /**
      * 新增目录信息
-     * 
+     *
      * @param docDir 目录信息
      * @return 结果
      */
@@ -37,7 +37,7 @@ public interface IDocDirService
 
     /**
      * 修改目录信息
-     * 
+     *
      * @param docDir 目录信息
      * @return 结果
      */
@@ -45,7 +45,7 @@ public interface IDocDirService
 
     /**
      * 批量删除目录信息
-     * 
+     *
      * @param dirIds 需要删除的目录信息主键集合
      * @return 结果
      */
@@ -53,9 +53,17 @@ public interface IDocDirService
 
     /**
      * 删除目录信息信息
-     * 
+     *
      * @param dirId 目录信息主键
      * @return 结果
      */
     public int deleteDocDirByDirId(Long dirId);
+
+    /**
+     * 是否有子目录
+     *
+     * @param dirId 目录ID
+     * @return
+     */
+    boolean hasChildByDirId(Long dirId);
 }

+ 1 - 1
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/IDocInfoDirService.java

@@ -7,7 +7,7 @@ import com.jjt.doc.domain.DocInfoDir;
  * 文档目录关系Service接口
  * 
  * @author wukai
- * @date 2023-03-27
+ * @date 2023-04-12
  */
 public interface IDocInfoDirService 
 {

+ 29 - 15
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/impl/DocDirServiceImpl.java

@@ -1,22 +1,24 @@
 package com.jjt.doc.service.impl;
 
 import java.util.List;
+
 import com.jjt.common.core.utils.DateUtils;
 import org.springframework.stereotype.Service;
 import com.jjt.doc.mapper.DocDirMapper;
 import com.jjt.doc.domain.DocDir;
+
 import javax.annotation.Resource;
+
 import com.jjt.doc.service.IDocDirService;
 
 /**
  * 目录信息Service业务层处理
  *
  * @author wukai
- * @date 2023-03-27
+ * @date 2023-04-12
  */
 @Service
-public class DocDirServiceImpl implements IDocDirService
-{
+public class DocDirServiceImpl implements IDocDirService {
     @Resource
     private DocDirMapper docDirMapper;
 
@@ -27,8 +29,7 @@ public class DocDirServiceImpl implements IDocDirService
      * @return 目录信息
      */
     @Override
-    public DocDir selectDocDirByDirId(Long dirId)
-    {
+    public DocDir selectDocDirByDirId(Long dirId) {
         return docDirMapper.selectDocDirByDirId(dirId);
     }
 
@@ -39,8 +40,7 @@ public class DocDirServiceImpl implements IDocDirService
      * @return 目录信息
      */
     @Override
-    public List<DocDir> selectDocDirList(DocDir docDir)
-    {
+    public List<DocDir> selectDocDirList(DocDir docDir) {
         return docDirMapper.selectDocDirList(docDir);
     }
 
@@ -51,8 +51,7 @@ public class DocDirServiceImpl implements IDocDirService
      * @return 结果
      */
     @Override
-    public int insertDocDir(DocDir docDir)
-    {
+    public int insertDocDir(DocDir docDir) {
         docDir.setCreateTime(DateUtils.getNowDate());
         return docDirMapper.insertDocDir(docDir);
     }
@@ -64,8 +63,7 @@ public class DocDirServiceImpl implements IDocDirService
      * @return 结果
      */
     @Override
-    public int updateDocDir(DocDir docDir)
-    {
+    public int updateDocDir(DocDir docDir) {
         docDir.setUpdateTime(DateUtils.getNowDate());
         return docDirMapper.updateDocDir(docDir);
     }
@@ -77,8 +75,7 @@ public class DocDirServiceImpl implements IDocDirService
      * @return 结果
      */
     @Override
-    public int deleteDocDirByDirIds(Long[] dirIds)
-    {
+    public int deleteDocDirByDirIds(Long[] dirIds) {
         return docDirMapper.deleteDocDirByDirIds(dirIds);
     }
 
@@ -89,8 +86,25 @@ public class DocDirServiceImpl implements IDocDirService
      * @return 结果
      */
     @Override
-    public int deleteDocDirByDirId(Long dirId)
-    {
+    public int deleteDocDirByDirId(Long dirId) {
         return docDirMapper.deleteDocDirByDirId(dirId);
     }
+
+    /**
+     * 是否有子目录
+     *
+     * @param dirId 目录ID
+     * @return
+     */
+    @Override
+    public boolean hasChildByDirId(Long dirId) {
+        DocDir doc = new DocDir();
+        doc.setParentId(dirId);
+        List list = docDirMapper.selectDocDirList(doc);
+        if (list.size() > 0) {
+            return true;
+        } else {
+            return false;
+        }
+    }
 }

+ 1 - 1
lzga-modules/lzga-doc/src/main/java/com/jjt/doc/service/impl/DocInfoDirServiceImpl.java

@@ -11,7 +11,7 @@ import com.jjt.doc.service.IDocInfoDirService;
  * 文档目录关系Service业务层处理
  *
  * @author wukai
- * @date 2023-03-27
+ * @date 2023-04-12
  */
 @Service
 public class DocInfoDirServiceImpl implements IDocInfoDirService

+ 1 - 8
lzga-modules/lzga-doc/src/main/resources/mapper/doc/DocDirMapper.xml

@@ -25,16 +25,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <select id="selectDocDirList" parameterType="DocDir" resultMap="DocDirResult">
         <include refid="selectDocDirVo"/>
         <where>  
-            <if test="spaceId != null "> and SPACE_ID = #{spaceId}</if>
             <if test="parentId != null "> and PARENT_ID = #{parentId}</if>
+            <if test="spaceId != null "> and SPACE_ID = #{spaceId}</if>
             <if test="dirName != null  and dirName != ''"> and DIR_NAME like concat('%', #{dirName}, '%')</if>
-            <if test="dirPath != null  and dirPath != ''"> and DIR_PATH = #{dirPath}</if>
-            <if test="createBy != null "> and CREATE_BY = #{createBy}</if>
-            <if test="createTime != null "> and CREATE_TIME = #{createTime}</if>
-            <if test="updateBy != null "> and UPDATE_BY = #{updateBy}</if>
-            <if test="updateTime != null "> and UPDATE_TIME = #{updateTime}</if>
-            <if test="remark != null  and remark != ''"> and REMARK = #{remark}</if>
-            <if test="isDel != null  and isDel != ''"> and IS_DEL = #{isDel}</if>
         </where>
     </select>
     

+ 5 - 3
lzga-modules/lzga-doc/src/main/resources/mapper/doc/DocInfoDirMapper.xml

@@ -6,18 +6,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     
     <resultMap type="DocInfoDir" id="DocInfoDirResult">
         <result property="docId"    column="DOC_ID"    />
+        <result property="docYear"    column="DOC_YEAR"    />
         <result property="dirId"    column="DIR_ID"    />
     </resultMap>
 
     <sql id="selectDocInfoDirVo">
-        select DOC_ID, DIR_ID from doc_info_dir
+        select DOC_ID, DOC_YEAR, DIR_ID from doc_info_dir
     </sql>
 
     <select id="selectDocInfoDirList" parameterType="DocInfoDir" resultMap="DocInfoDirResult">
         <include refid="selectDocInfoDirVo"/>
         <where>  
-            <if test="docId != null "> and DOC_ID = #{docId}</if>
-            <if test="dirId != null "> and DIR_ID = #{dirId}</if>
         </where>
     </select>
     
@@ -30,10 +29,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
         insert into doc_info_dir
         <trim prefix="(" suffix=")" suffixOverrides=",">
             <if test="docId != null">DOC_ID,</if>
+            <if test="docYear != null">DOC_YEAR,</if>
             <if test="dirId != null">DIR_ID,</if>
          </trim>
         <trim prefix="values (" suffix=")" suffixOverrides=",">
             <if test="docId != null">#{docId},</if>
+            <if test="docYear != null">#{docYear},</if>
             <if test="dirId != null">#{dirId},</if>
          </trim>
     </insert>
@@ -41,6 +42,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
     <update id="updateDocInfoDir" parameterType="DocInfoDir">
         update doc_info_dir
         <trim prefix="SET" suffixOverrides=",">
+            <if test="docYear != null">DOC_YEAR = #{docYear},</if>
             <if test="dirId != null">DIR_ID = #{dirId},</if>
         </trim>
         where DOC_ID = #{docId}

+ 7 - 0
lzga-ui/src/api/doc/dir.js

@@ -8,6 +8,13 @@ export function listDir(query) {
     params: query
   })
 }
+// 查询目录信息列表
+export function personalList() {
+  return request({
+    url: '/doc/dir/list/personal',
+    method: 'get',
+  })
+}
 
 // 查询目录信息详细
 export function getDir(dirId) {

+ 8 - 0
lzga-ui/src/api/doc/space.js

@@ -41,4 +41,12 @@ export function delSpace(spaceId) {
     url: '/doc/space/' + spaceId,
     method: 'delete'
   })
+}
+
+// 查询当前登录用户空间
+export function getPersonalSpace() {
+  return request({
+    url: '/doc/space/personal',
+    method: 'get'
+  })
 }

+ 194 - 313
lzga-ui/src/views/doc/dir/index.vue

@@ -1,207 +1,55 @@
 <template>
   <div class="app-container">
-    <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
-      <el-form-item label="空间ID" prop="spaceId">
-        <el-input
-          v-model="queryParams.spaceId"
-          placeholder="请输入空间ID"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
+    <!-- <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="父目录ID" prop="parentId">
-        <el-input
-          v-model="queryParams.parentId"
-          placeholder="请输入父目录ID"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.parentId" placeholder="请输入父目录ID" clearable @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item label="目录名称" prop="dirName">
-        <el-input
-          v-model="queryParams.dirName"
-          placeholder="请输入目录名称"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="目录路径" prop="dirPath">
-        <el-input
-          v-model="queryParams.dirPath"
-          placeholder="请输入目录路径"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="创建人" prop="createBy">
-        <el-input
-          v-model="queryParams.createBy"
-          placeholder="请输入创建人"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="创建时间" prop="createTime">
-        <el-date-picker clearable
-          v-model="queryParams.createTime"
-          type="date"
-          value-format="yyyy-MM-dd"
-          placeholder="请选择创建时间">
-        </el-date-picker>
-      </el-form-item>
-      <el-form-item label="更新人" prop="updateBy">
-        <el-input
-          v-model="queryParams.updateBy"
-          placeholder="请输入更新人"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="更新时间" prop="updateTime">
-        <el-date-picker clearable
-          v-model="queryParams.updateTime"
-          type="date"
-          value-format="yyyy-MM-dd"
-          placeholder="请选择更新时间">
-        </el-date-picker>
-      </el-form-item>
-      <el-form-item label="备注" prop="remark">
-        <el-input
-          v-model="queryParams.remark"
-          placeholder="请输入备注"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
-      </el-form-item>
-      <el-form-item label="逻辑删除标志;1/非1" prop="isDel">
-        <el-input
-          v-model="queryParams.isDel"
-          placeholder="请输入逻辑删除标志;1/非1"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.dirName" placeholder="请输入目录名称" clearable @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
         <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
       </el-form-item>
     </el-form>
-
+ -->
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
-        <el-button
-          type="primary"
-          plain
-          icon="el-icon-plus"
-          size="mini"
-          @click="handleAdd"
-          v-hasPermi="['doc:dir:add']"
-        >新增</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="success"
-          plain
-          icon="el-icon-edit"
-          size="mini"
-          :disabled="single"
-          @click="handleUpdate"
-          v-hasPermi="['doc:dir:edit']"
-        >修改</el-button>
-      </el-col>
-      <el-col :span="1.5">
-        <el-button
-          type="danger"
-          plain
-          icon="el-icon-delete"
-          size="mini"
-          :disabled="multiple"
-          @click="handleDelete"
-          v-hasPermi="['doc:dir:remove']"
-        >删除</el-button>
+        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
+          v-hasPermi="['doc:dir:add']">新增</el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button
-          type="warning"
-          plain
-          icon="el-icon-download"
-          size="mini"
-          @click="handleExport"
-          v-hasPermi="['doc:dir:export']"
-        >导出</el-button>
+        <el-button type="info" plain icon="el-icon-sort" size="mini" @click="toggleExpandAll">展开/折叠</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table v-loading="loading" :data="dirList" @selection-change="handleSelectionChange">
-      <el-table-column type="selection" width="55" align="center" />
-      <el-table-column label="目录ID" align="center" prop="dirId" />
-      <el-table-column label="空间ID" align="center" prop="spaceId" />
-      <el-table-column label="父目录ID" align="center" prop="parentId" />
+    <el-table v-if="refreshTable" v-loading="loading" :data="dirList" row-key="dirId" :default-expand-all="isExpandAll"
+      :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
       <el-table-column label="目录名称" align="center" prop="dirName" />
-      <el-table-column label="目录路径" align="center" prop="dirPath" />
-      <el-table-column label="创建人" align="center" prop="createBy" />
-      <el-table-column label="创建时间" align="center" prop="createTime" width="180">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.createTime, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="更新人" align="center" prop="updateBy" />
-      <el-table-column label="更新时间" align="center" prop="updateTime" width="180">
-        <template slot-scope="scope">
-          <span>{{ parseTime(scope.row.updateTime, '{y}-{m}-{d}') }}</span>
-        </template>
-      </el-table-column>
-      <el-table-column label="备注" align="center" prop="remark" />
-      <el-table-column label="逻辑删除标志;1/非1" align="center" prop="isDel" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['doc:dir:edit']"
-          >修改</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['doc:dir:remove']"
-          >删除</el-button>
+          <el-button size="mini" type="text" icon="el-icon-plus" @click="handleAdd(scope.row)"
+            v-hasPermi="['doc:dir:add']">新增</el-button>
+          <el-button v-if="scope.row.parentId != 0" size="mini" type="text" icon="el-icon-edit"
+            @click="handleUpdate(scope.row)" v-hasPermi="['doc:dir:edit']">修改</el-button>
+          <el-button v-if="scope.row.parentId != 0" size="mini" type="text" icon="el-icon-delete"
+            @click="handleDelete(scope.row)" v-hasPermi="['doc:dir:remove']">删除</el-button>
         </template>
       </el-table-column>
     </el-table>
-    
-    <pagination
-      v-show="total>0"
-      :total="total"
-      :page.sync="queryParams.pageNum"
-      :limit.sync="queryParams.pageSize"
-      @pagination="getList"
-    />
 
     <!-- 添加或修改目录信息对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
       <el-form ref="form" :model="form" :rules="rules" label-width="80px">
-        <el-form-item label="空间ID" prop="spaceId">
-          <el-input v-model="form.spaceId" placeholder="请输入空间ID" />
-        </el-form-item>
-        <el-form-item label="父目录ID" prop="parentId">
-          <el-input v-model="form.parentId" placeholder="请输入父目录ID" />
+        <el-form-item label="上级目录" prop="parentId">
+          <treeselect v-model="form.parentId" :options="dirOptions" :normalizer="normalizer" placeholder="请选择上级目录" />
         </el-form-item>
         <el-form-item label="目录名称" prop="dirName">
           <el-input v-model="form.dirName" placeholder="请输入目录名称" />
         </el-form-item>
-        <el-form-item label="目录路径" prop="dirPath">
-          <el-input v-model="form.dirPath" placeholder="请输入目录路径" />
-        </el-form-item>
         <el-form-item label="备注" prop="remark">
-          <el-input v-model="form.remark" placeholder="请输入备注" />
-        </el-form-item>
-        <el-form-item label="逻辑删除标志;1/非1" prop="isDel">
-          <el-input v-model="form.isDel" placeholder="请输入逻辑删除标志;1/非1" />
+          <el-input v-model="form.remark" type="textarea" placeholder="请输入内容" />
         </el-form-item>
       </el-form>
       <div slot="footer" class="dialog-footer">
@@ -213,155 +61,188 @@
 </template>
 
 <script>
-import { listDir, getDir, delDir, addDir, updateDir } from "@/api/doc/dir";
+  import {
+    listDir,
+    getDir,
+    delDir,
+    addDir,
+    updateDir,
+    personalList
+  } from "@/api/doc/dir";
+  import {
+    getPersonalSpace
+  } from "@/api/doc/space";
+  import Treeselect from "@riophae/vue-treeselect";
+  import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 
-export default {
-  name: "Dir",
-  data() {
-    return {
-      // 遮罩层
-      loading: true,
-      // 选中数组
-      ids: [],
-      // 非单个禁用
-      single: true,
-      // 非多个禁用
-      multiple: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 总条数
-      total: 0,
-      // 目录信息表格数据
-      dirList: [],
-      // 弹出层标题
-      title: "",
-      // 是否显示弹出层
-      open: false,
-      // 查询参数
-      queryParams: {
-        pageNum: 1,
-        pageSize: 10,
-        spaceId: null,
-        parentId: null,
-        dirName: null,
-        dirPath: null,
-        createBy: null,
-        createTime: null,
-        updateBy: null,
-        updateTime: null,
-        remark: null,
-        isDel: null
-      },
-      // 表单参数
-      form: {},
-      // 表单校验
-      rules: {
-      }
-    };
-  },
-  created() {
-    this.getList();
-  },
-  methods: {
-    /** 查询目录信息列表 */
-    getList() {
-      this.loading = true;
-      listDir(this.queryParams).then(response => {
-        this.dirList = response.rows;
-        this.total = response.total;
-        this.loading = false;
-      });
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
+  export default {
+    name: "Dir",
+    components: {
+      Treeselect
     },
-    // 表单重置
-    reset() {
-      this.form = {
-        dirId: null,
-        spaceId: null,
-        parentId: null,
-        dirName: null,
-        dirPath: null,
-        createBy: null,
-        createTime: null,
-        updateBy: null,
-        updateTime: null,
-        remark: null,
-        isDel: null
+    data() {
+      return {
+        // 遮罩层
+        loading: true,
+        // 显示搜索条件
+        showSearch: true,
+        // 目录信息表格数据
+        dirList: [],
+        // 目录信息树选项
+        dirOptions: [],
+        // 弹出层标题
+        title: "",
+        // 是否显示弹出层
+        open: false,
+        // 是否展开,默认全部展开
+        isExpandAll: true,
+        // 重新渲染表格状态
+        refreshTable: true,
+        // 查询参数
+        queryParams: {
+          parentId: null,
+          dirName: null,
+        },
+        // 表单参数
+        form: {},
+        // 表单校验
+        // 表单校验
+        rules: {
+          dirName: [{
+            required: true,
+            message: "目录名称不能为空",
+            trigger: "blur"
+          }],
+          parentId: [{
+            required: true,
+            message: "上级目录不能为空",
+            trigger: "blur"
+          }],
+        }
       };
-      this.resetForm("form");
     },
-    /** 搜索按钮操作 */
-    handleQuery() {
-      this.queryParams.pageNum = 1;
+    created() {
       this.getList();
     },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
-    },
-    // 多选框选中数据
-    handleSelectionChange(selection) {
-      this.ids = selection.map(item => item.dirId)
-      this.single = selection.length!==1
-      this.multiple = !selection.length
-    },
-    /** 新增按钮操作 */
-    handleAdd() {
-      this.reset();
-      this.open = true;
-      this.title = "添加目录信息";
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      const dirId = row.dirId || this.ids
-      getDir(dirId).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改目录信息";
-      });
-    },
-    /** 提交按钮 */
-    submitForm() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.dirId != null) {
-            updateDir(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addDir(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
+    methods: {
+      /** 查询目录信息列表 */
+      getList() {
+        this.loading = true;
+        personalList().then(response => {
+          this.dirList = this.handleTree(response.data, "dirId");
+          this.loading = false;
+        });
+      },
+      /** 转换目录信息数据结构 */
+      normalizer(node) {
+        if (node.children && !node.children.length) {
+          delete node.children;
         }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      const dirIds = row.dirId || this.ids;
-      this.$modal.confirm('是否确认删除目录信息编号为"' + dirIds + '"的数据项?').then(function() {
-        return delDir(dirIds);
-      }).then(() => {
+        return {
+          id: node.dirId,
+          label: node.dirName,
+          children: node.children
+        };
+      },
+      // 取消按钮
+      cancel() {
+        this.open = false;
+        this.reset();
+      },
+      // 表单重置
+      reset() {
+        this.form = {
+          dirId: null,
+          spaceId: null,
+          parentId: null,
+          dirName: null,
+          dirPath: null,
+          createBy: null,
+          createTime: null,
+          updateBy: null,
+          updateTime: null,
+          remark: null,
+          isDel: null
+        };
+        this.resetForm("form");
+      },
+      /** 搜索按钮操作 */
+      handleQuery() {
         this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
-    },
-    /** 导出按钮操作 */
-    handleExport() {
-      this.download('doc/dir/export', {
-        ...this.queryParams
-      }, `dir_${new Date().getTime()}.xlsx`)
+      },
+      /** 重置按钮操作 */
+      resetQuery() {
+        this.resetForm("queryForm");
+        this.handleQuery();
+      },
+      /** 新增按钮操作 */
+      handleAdd(row) {
+        this.reset();
+        // this.getTreeselect();
+        if (row != null && row.dirId) {
+          this.form.parentId = row.dirId;
+          // } else {
+          // 	this.form.parentId = 0;
+        }
+        this.open = true;
+        this.title = "添加目录信息";
+        personalList().then(response => {
+          this.form.spaceId = response.data[0].spaceId;
+          this.dirOptions = this.handleTree(response.data, "dirId");
+        });
+      },
+      /** 展开/折叠操作 */
+      toggleExpandAll() {
+        this.refreshTable = false;
+        this.isExpandAll = !this.isExpandAll;
+        this.$nextTick(() => {
+          this.refreshTable = true;
+        });
+      },
+      /** 修改按钮操作 */
+      handleUpdate(row) {
+        this.reset();
+        if (row != null) {
+          this.form.parentId = row.dirId;
+        }
+        getDir(row.dirId).then(response => {
+          this.form = response.data;
+          this.open = true;
+          this.title = "修改目录信息";
+        });
+        personalList().then(response => {
+          this.dirOptions = this.handleTree(response.data, "dirId");
+        });
+      },
+      /** 提交按钮 */
+      submitForm() {
+        this.$refs["form"].validate(valid => {
+          if (valid) {
+            if (this.form.dirId != null) {
+              updateDir(this.form).then(response => {
+                this.$modal.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              });
+            } else {
+              addDir(this.form).then(response => {
+                this.$modal.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              });
+            }
+          }
+        });
+      },
+      /** 删除按钮操作 */
+      handleDelete(row) {
+        this.$modal.confirm('是否确认删除目录信息编号为"' + row.dirId + '"的数据项?').then(function() {
+          return delDir(row.dirId);
+        }).then(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
+        }).catch(() => {});
+      }
     }
-  }
-};
-</script>
+  };
+</script>

+ 217 - 160
lzga-ui/src/views/doc/expand/index.vue

@@ -2,13 +2,28 @@
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
       <el-form-item label="空间ID" prop="spaceId">
-        <el-input v-model="queryParams.spaceId" placeholder="请输入空间ID" clearable @keyup.enter.native="handleQuery" />
+        <el-input
+          v-model="queryParams.spaceId"
+          placeholder="请输入空间ID"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
       </el-form-item>
       <el-form-item label="当前容量" prop="currentCap">
-        <el-input v-model="queryParams.currentCap" placeholder="请输入当前容量" clearable @keyup.enter.native="handleQuery" />
+        <el-input
+          v-model="queryParams.currentCap"
+          placeholder="请输入当前容量"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
       </el-form-item>
       <el-form-item label="扩充容量" prop="expandCap">
-        <el-input v-model="queryParams.expandCap" placeholder="请输入扩充容量" clearable @keyup.enter.native="handleQuery" />
+        <el-input
+          v-model="queryParams.expandCap"
+          placeholder="请输入扩充容量"
+          clearable
+          @keyup.enter.native="handleQuery"
+        />
       </el-form-item>
       <el-form-item>
         <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
@@ -18,20 +33,46 @@
 
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
-        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
-          v-hasPermi="['doc:expand:add']">新增</el-button>
+        <el-button
+          type="primary"
+          plain
+          icon="el-icon-plus"
+          size="mini"
+          @click="handleAdd"
+          v-hasPermi="['doc:expand:add']"
+        >新增</el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button type="success" plain icon="el-icon-edit" size="mini" :disabled="single" @click="handleUpdate"
-          v-hasPermi="['doc:expand:edit']">修改</el-button>
+        <el-button
+          type="success"
+          plain
+          icon="el-icon-edit"
+          size="mini"
+          :disabled="single"
+          @click="handleUpdate"
+          v-hasPermi="['doc:expand:edit']"
+        >修改</el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button type="danger" plain icon="el-icon-delete" size="mini" :disabled="multiple" @click="handleDelete"
-          v-hasPermi="['doc:expand:remove']">删除</el-button>
+        <el-button
+          type="danger"
+          plain
+          icon="el-icon-delete"
+          size="mini"
+          :disabled="multiple"
+          @click="handleDelete"
+          v-hasPermi="['doc:expand:remove']"
+        >删除</el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button type="warning" plain icon="el-icon-download" size="mini" @click="handleExport"
-          v-hasPermi="['doc:expand:export']">导出</el-button>
+        <el-button
+          type="warning"
+          plain
+          icon="el-icon-download"
+          size="mini"
+          @click="handleExport"
+          v-hasPermi="['doc:expand:export']"
+        >导出</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
@@ -46,16 +87,31 @@
       <el-table-column label="备注" align="center" prop="remark" />
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
-            v-hasPermi="['doc:expand:edit']">修改</el-button>
-          <el-button size="mini" type="text" icon="el-icon-delete" @click="handleDelete(scope.row)"
-            v-hasPermi="['doc:expand:remove']">删除</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-edit"
+            @click="handleUpdate(scope.row)"
+            v-hasPermi="['doc:expand:edit']"
+          >修改</el-button>
+          <el-button
+            size="mini"
+            type="text"
+            icon="el-icon-delete"
+            @click="handleDelete(scope.row)"
+            v-hasPermi="['doc:expand:remove']"
+          >删除</el-button>
         </template>
       </el-table-column>
     </el-table>
-
-    <pagination v-show="total>0" :total="total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize"
-      @pagination="getList" />
+    
+    <pagination
+      v-show="total>0"
+      :total="total"
+      :page.sync="queryParams.pageNum"
+      :limit.sync="queryParams.pageSize"
+      @pagination="getList"
+    />
 
     <!-- 添加或修改扩容申请对话框 -->
     <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
@@ -79,153 +135,154 @@
 </template>
 
 <script>
-  import {
-    listExpand,
-    getExpand,
-    delExpand,
-    addExpand,
-    updateExpand
-  } from "@/api/doc/expand";
+import { listExpand, getExpand, delExpand, addExpand, updateExpand } from "@/api/doc/expand";
 
-  export default {
-    name: "Expand",
-    data() {
-      return {
-        // 遮罩层
-        loading: true,
-        // 选中数组
-        ids: [],
-        // 非单个禁用
-        single: true,
-        // 非多个禁用
-        multiple: true,
-        // 显示搜索条件
-        showSearch: true,
-        // 总条数
-        total: 0,
-        // 扩容申请表格数据
-        expandList: [],
-        // 弹出层标题
-        title: "",
-        // 是否显示弹出层
-        open: false,
-        // 查询参数
-        queryParams: {
-          pageNum: 1,
-          pageSize: 10,
-          spaceId: null,
-          currentCap: null,
-          expandCap: null,
-        },
-        // 表单参数
-        form: {},
-        // 表单校验
-        rules: {}
+export default {
+  name: "Expand",
+  data() {
+    return {
+      // 遮罩层
+      loading: true,
+      // 选中数组
+      ids: [],
+      // 非单个禁用
+      single: true,
+      // 非多个禁用
+      multiple: true,
+      // 显示搜索条件
+      showSearch: true,
+      // 总条数
+      total: 0,
+      // 扩容申请表格数据
+      expandList: [],
+      // 弹出层标题
+      title: "",
+      // 是否显示弹出层
+      open: false,
+      // 查询参数
+      queryParams: {
+        pageNum: 1,
+        pageSize: 10,
+        spaceId: null,
+        currentCap: null,
+        expandCap: null,
+      },
+      // 表单参数
+      form: {},
+      // 表单校验
+      rules: {
+        expandCap: [
+          { required: true, message: "扩充容量不能为空", trigger: "blur" }
+        ],
+        remark: [
+          { required: true, message: "备注不能为空", trigger: "blur" }
+        ],
+      }
+    };
+  },
+  created() {
+    this.getList();
+  },
+  methods: {
+    /** 查询扩容申请列表 */
+    getList() {
+      this.loading = true;
+      listExpand(this.queryParams).then(response => {
+        this.expandList = response.rows;
+        this.total = response.total;
+        this.loading = false;
+      });
+    },
+    // 取消按钮
+    cancel() {
+      this.open = false;
+      this.reset();
+    },
+    // 表单重置
+    reset() {
+      this.form = {
+        expandId: null,
+        spaceId: null,
+        currentCap: null,
+        expandCap: null,
+        expandStatus: null,
+        createBy: null,
+        createTime: null,
+        updateBy: null,
+        updateTime: null,
+        remark: null,
+        isDel: null
       };
+      this.resetForm("form");
     },
-    created() {
+    /** 搜索按钮操作 */
+    handleQuery() {
+      this.queryParams.pageNum = 1;
       this.getList();
     },
-    methods: {
-      /** 查询扩容申请列表 */
-      getList() {
-        this.loading = true;
-        listExpand(this.queryParams).then(response => {
-          this.expandList = response.rows;
-          this.total = response.total;
-          this.loading = false;
-        });
-      },
-      // 取消按钮
-      cancel() {
-        this.open = false;
-        this.reset();
-      },
-      // 表单重置
-      reset() {
-        this.form = {
-          expandId: null,
-          spaceId: null,
-          currentCap: null,
-          expandCap: null,
-          expandStatus: null,
-          createBy: null,
-          createTime: null,
-          updateBy: null,
-          updateTime: null,
-          remark: null,
-          isDel: null
-        };
-        this.resetForm("form");
-      },
-      /** 搜索按钮操作 */
-      handleQuery() {
-        this.queryParams.pageNum = 1;
-        this.getList();
-      },
-      /** 重置按钮操作 */
-      resetQuery() {
-        this.resetForm("queryForm");
-        this.handleQuery();
-      },
-      // 多选框选中数据
-      handleSelectionChange(selection) {
-        this.ids = selection.map(item => item.expandId)
-        this.single = selection.length !== 1
-        this.multiple = !selection.length
-      },
-      /** 新增按钮操作 */
-      handleAdd() {
-        this.reset();
+    /** 重置按钮操作 */
+    resetQuery() {
+      this.resetForm("queryForm");
+      this.handleQuery();
+    },
+    // 多选框选中数据
+    handleSelectionChange(selection) {
+      this.ids = selection.map(item => item.expandId)
+      this.single = selection.length!==1
+      this.multiple = !selection.length
+    },
+    /** 新增按钮操作 */
+    handleAdd() {
+      this.reset();
+      this.open = true;
+      this.title = "添加扩容申请";
+    },
+    /** 修改按钮操作 */
+    handleUpdate(row) {
+      this.reset();
+      const expandId = row.expandId || this.ids
+      getExpand(expandId).then(response => {
+        this.form = response.data;
         this.open = true;
-        this.title = "添加扩容申请";
-      },
-      /** 修改按钮操作 */
-      handleUpdate(row) {
-        this.reset();
-        const expandId = row.expandId || this.ids
-        getExpand(expandId).then(response => {
-          this.form = response.data;
-          this.open = true;
-          this.title = "修改扩容申请";
-        });
-      },
-      /** 提交按钮 */
-      submitForm() {
-        this.$refs["form"].validate(valid => {
-          if (valid) {
-            if (this.form.expandId != null) {
-              updateExpand(this.form).then(response => {
-                this.$modal.msgSuccess("修改成功");
-                this.open = false;
-                this.getList();
-              });
-            } else {
-              addExpand(this.form).then(response => {
-                this.$modal.msgSuccess("新增成功");
-                this.open = false;
-                this.getList();
-              });
-            }
+        this.title = "修改扩容申请";
+      });
+    },
+    /** 提交按钮 */
+    submitForm() {
+      this.$refs["form"].validate(valid => {
+        if (valid) {
+          if (this.form.expandId != null) {
+            updateExpand(this.form).then(response => {
+              this.$modal.msgSuccess("修改成功");
+              this.open = false;
+              this.getList();
+            });
+          } else {
+            addExpand(this.form).then(response => {
+              this.$modal.msgSuccess("新增成功");
+              this.open = false;
+              this.getList();
+            });
           }
-        });
-      },
-      /** 删除按钮操作 */
-      handleDelete(row) {
-        const expandIds = row.expandId || this.ids;
-        this.$modal.confirm('是否确认删除扩容申请编号为"' + expandIds + '"的数据项?').then(function() {
-          return delExpand(expandIds);
-        }).then(() => {
-          this.getList();
-          this.$modal.msgSuccess("删除成功");
-        }).catch(() => {});
-      },
-      /** 导出按钮操作 */
-      handleExport() {
-        this.download('doc/expand/export', {
-          ...this.queryParams
-        }, `expand_${new Date().getTime()}.xlsx`)
-      }
+        }
+      });
+    },
+    /** 删除按钮操作 */
+    handleDelete(row) {
+      const expandIds = row.expandId || this.ids;
+      this.$modal.confirm('是否确认删除扩容申请编号为"' + expandIds + '"的数据项?').then(function() {
+        return delExpand(expandIds);
+      }).then(() => {
+        this.getList();
+        this.$modal.msgSuccess("删除成功");
+      }).catch(() => {});
+    },
+    /** 导出按钮操作 */
+    handleExport() {
+      this.download('doc/expand/export', {
+        ...this.queryParams
+      }, `expand_${new Date().getTime()}.xlsx`)
     }
-  };
-</script>
+  }
+};
+</script>

+ 192 - 226
lzga-ui/src/views/system/dept/index.vue

@@ -2,21 +2,12 @@
   <div class="app-container">
     <el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch">
       <el-form-item label="部门名称" prop="deptName">
-        <el-input
-          v-model="queryParams.deptName"
-          placeholder="请输入部门名称"
-          clearable
-          @keyup.enter.native="handleQuery"
-        />
+        <el-input v-model="queryParams.deptName" placeholder="请输入部门名称" clearable @keyup.enter.native="handleQuery" />
       </el-form-item>
       <el-form-item label="状态" prop="status">
         <el-select v-model="queryParams.status" placeholder="部门状态" clearable>
-          <el-option
-            v-for="dict in dict.type.sys_normal_disable"
-            :key="dict.value"
-            :label="dict.label"
-            :value="dict.value"
-          />
+          <el-option v-for="dict in dict.type.sys_normal_disable" :key="dict.value" :label="dict.label"
+            :value="dict.value" />
         </el-select>
       </el-form-item>
       <el-form-item>
@@ -27,40 +18,22 @@
 
     <el-row :gutter="10" class="mb8">
       <el-col :span="1.5">
-        <el-button
-          type="primary"
-          plain
-          icon="el-icon-plus"
-          size="mini"
-          @click="handleAdd"
-          v-hasPermi="['system:dept:add']"
-        >新增</el-button>
+        <el-button type="primary" plain icon="el-icon-plus" size="mini" @click="handleAdd"
+          v-hasPermi="['system:dept:add']">新增</el-button>
       </el-col>
       <el-col :span="1.5">
-        <el-button
-          type="info"
-          plain
-          icon="el-icon-sort"
-          size="mini"
-          @click="toggleExpandAll"
-        >展开/折叠</el-button>
+        <el-button type="info" plain icon="el-icon-sort" size="mini" @click="toggleExpandAll">展开/折叠</el-button>
       </el-col>
       <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
     </el-row>
 
-    <el-table
-      v-if="refreshTable"
-      v-loading="loading"
-      :data="deptList"
-      row-key="deptId"
-      :default-expand-all="isExpandAll"
-      :tree-props="{children: 'children', hasChildren: 'hasChildren'}"
-    >
+    <el-table v-if="refreshTable" v-loading="loading" :data="deptList" row-key="deptId"
+      :default-expand-all="isExpandAll" :tree-props="{children: 'children', hasChildren: 'hasChildren'}">
       <el-table-column prop="deptName" label="部门名称" width="260"></el-table-column>
       <el-table-column prop="orderNum" label="排序" width="200"></el-table-column>
       <el-table-column prop="status" label="状态" width="100">
         <template slot-scope="scope">
-          <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
+          <dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status" />
         </template>
       </el-table-column>
       <el-table-column label="创建时间" align="center" prop="createTime" width="200">
@@ -70,28 +43,12 @@
       </el-table-column>
       <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
         <template slot-scope="scope">
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-edit"
-            @click="handleUpdate(scope.row)"
-            v-hasPermi="['system:dept:edit']"
-          >修改</el-button>
-          <el-button
-            size="mini"
-            type="text"
-            icon="el-icon-plus"
-            @click="handleAdd(scope.row)"
-            v-hasPermi="['system:dept:add']"
-          >新增</el-button>
-          <el-button
-            v-if="scope.row.parentId != 0"
-            size="mini"
-            type="text"
-            icon="el-icon-delete"
-            @click="handleDelete(scope.row)"
-            v-hasPermi="['system:dept:remove']"
-          >删除</el-button>
+          <el-button size="mini" type="text" icon="el-icon-edit" @click="handleUpdate(scope.row)"
+            v-hasPermi="['system:dept:edit']">修改</el-button>
+          <el-button size="mini" type="text" icon="el-icon-plus" @click="handleAdd(scope.row)"
+            v-hasPermi="['system:dept:add']">新增</el-button>
+          <el-button v-if="scope.row.parentId != 0" size="mini" type="text" icon="el-icon-delete"
+            @click="handleDelete(scope.row)" v-hasPermi="['system:dept:remove']">删除</el-button>
         </template>
       </el-table-column>
     </el-table>
@@ -102,7 +59,8 @@
         <el-row>
           <el-col :span="24" v-if="form.parentId !== 0">
             <el-form-item label="上级部门" prop="parentId">
-              <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer" placeholder="选择上级部门" />
+              <treeselect v-model="form.parentId" :options="deptOptions" :normalizer="normalizer"
+                placeholder="选择上级部门" />
             </el-form-item>
           </el-col>
         </el-row>
@@ -139,11 +97,8 @@
           <el-col :span="12">
             <el-form-item label="部门状态">
               <el-radio-group v-model="form.status">
-                <el-radio
-                  v-for="dict in dict.type.sys_normal_disable"
-                  :key="dict.value"
-                  :label="dict.value"
-                >{{dict.label}}</el-radio>
+                <el-radio v-for="dict in dict.type.sys_normal_disable" :key="dict.value"
+                  :label="dict.value">{{dict.label}}</el-radio>
               </el-radio-group>
             </el-form-item>
           </el-col>
@@ -158,179 +113,190 @@
 </template>
 
 <script>
-import { listDept, getDept, delDept, addDept, updateDept, listDeptExcludeChild } from "@/api/system/dept";
-import Treeselect from "@riophae/vue-treeselect";
-import "@riophae/vue-treeselect/dist/vue-treeselect.css";
+  import {
+    listDept,
+    getDept,
+    delDept,
+    addDept,
+    updateDept,
+    listDeptExcludeChild
+  } from "@/api/system/dept";
+  import Treeselect from "@riophae/vue-treeselect";
+  import "@riophae/vue-treeselect/dist/vue-treeselect.css";
 
-export default {
-  name: "Dept",
-  dicts: ['sys_normal_disable'],
-  components: { Treeselect },
-  data() {
-    return {
-      // 遮罩层
-      loading: true,
-      // 显示搜索条件
-      showSearch: true,
-      // 表格树数据
-      deptList: [],
-      // 部门树选项
-      deptOptions: [],
-      // 弹出层标题
-      title: "",
-      // 是否显示弹出层
-      open: false,
-      // 是否展开,默认全部展开
-      isExpandAll: true,
-      // 重新渲染表格状态
-      refreshTable: true,
-      // 查询参数
-      queryParams: {
-        deptName: undefined,
-        status: undefined
-      },
-      // 表单参数
-      form: {},
-      // 表单校验
-      rules: {
-        parentId: [
-          { required: true, message: "上级部门不能为空", trigger: "blur" }
-        ],
-        deptName: [
-          { required: true, message: "部门名称不能为空", trigger: "blur" }
-        ],
-        orderNum: [
-          { required: true, message: "显示排序不能为空", trigger: "blur" }
-        ],
-        email: [
-          {
+  export default {
+    name: "Dept",
+    dicts: ['sys_normal_disable'],
+    components: {
+      Treeselect
+    },
+    data() {
+      return {
+        // 遮罩层
+        loading: true,
+        // 显示搜索条件
+        showSearch: true,
+        // 表格树数据
+        deptList: [],
+        // 部门树选项
+        deptOptions: [],
+        // 弹出层标题
+        title: "",
+        // 是否显示弹出层
+        open: false,
+        // 是否展开,默认全部展开
+        isExpandAll: true,
+        // 重新渲染表格状态
+        refreshTable: true,
+        // 查询参数
+        queryParams: {
+          deptName: undefined,
+          status: undefined
+        },
+        // 表单参数
+        form: {},
+        // 表单校验
+        rules: {
+          parentId: [{
+            required: true,
+            message: "上级部门不能为空",
+            trigger: "blur"
+          }],
+          deptName: [{
+            required: true,
+            message: "部门名称不能为空",
+            trigger: "blur"
+          }],
+          orderNum: [{
+            required: true,
+            message: "显示排序不能为空",
+            trigger: "blur"
+          }],
+          email: [{
             type: "email",
             message: "请输入正确的邮箱地址",
             trigger: ["blur", "change"]
-          }
-        ],
-        phone: [
-          {
+          }],
+          phone: [{
             pattern: /^1[3|4|5|6|7|8|9][0-9]\d{8}$/,
             message: "请输入正确的手机号码",
             trigger: "blur"
-          }
-        ]
-      }
-    };
-  },
-  created() {
-    this.getList();
-  },
-  methods: {
-    /** 查询部门列表 */
-    getList() {
-      this.loading = true;
-      listDept(this.queryParams).then(response => {
-        this.deptList = this.handleTree(response.data, "deptId");
-        this.loading = false;
-      });
-    },
-    /** 转换部门数据结构 */
-    normalizer(node) {
-      if (node.children && !node.children.length) {
-        delete node.children;
-      }
-      return {
-        id: node.deptId,
-        label: node.deptName,
-        children: node.children
-      };
-    },
-    // 取消按钮
-    cancel() {
-      this.open = false;
-      this.reset();
-    },
-    // 表单重置
-    reset() {
-      this.form = {
-        deptId: undefined,
-        parentId: undefined,
-        deptName: undefined,
-        orderNum: undefined,
-        leader: undefined,
-        phone: undefined,
-        email: undefined,
-        status: "0"
+          }]
+        }
       };
-      this.resetForm("form");
     },
-    /** 搜索按钮操作 */
-    handleQuery() {
+    created() {
       this.getList();
     },
-    /** 重置按钮操作 */
-    resetQuery() {
-      this.resetForm("queryForm");
-      this.handleQuery();
-    },
-    /** 新增按钮操作 */
-    handleAdd(row) {
-      this.reset();
-      if (row != undefined) {
-        this.form.parentId = row.deptId;
-      }
-      this.open = true;
-      this.title = "添加部门";
-      listDept().then(response => {
-        this.deptOptions = this.handleTree(response.data, "deptId");
-      });
-    },
-    /** 展开/折叠操作 */
-    toggleExpandAll() {
-      this.refreshTable = false;
-      this.isExpandAll = !this.isExpandAll;
-      this.$nextTick(() => {
-        this.refreshTable = true;
-      });
-    },
-    /** 修改按钮操作 */
-    handleUpdate(row) {
-      this.reset();
-      getDept(row.deptId).then(response => {
-        this.form = response.data;
-        this.open = true;
-        this.title = "修改部门";
-      });
-      listDeptExcludeChild(row.deptId).then(response => {
-        this.deptOptions = this.handleTree(response.data, "deptId");
-      });
-    },
-    /** 提交按钮 */
-    submitForm: function() {
-      this.$refs["form"].validate(valid => {
-        if (valid) {
-          if (this.form.deptId != undefined) {
-            updateDept(this.form).then(response => {
-              this.$modal.msgSuccess("修改成功");
-              this.open = false;
-              this.getList();
-            });
-          } else {
-            addDept(this.form).then(response => {
-              this.$modal.msgSuccess("新增成功");
-              this.open = false;
-              this.getList();
-            });
-          }
+    methods: {
+      /** 查询部门列表 */
+      getList() {
+        this.loading = true;
+        listDept(this.queryParams).then(response => {
+          this.deptList = this.handleTree(response.data, "deptId");
+          this.loading = false;
+        });
+      },
+      /** 转换部门数据结构 */
+      normalizer(node) {
+        if (node.children && !node.children.length) {
+          delete node.children;
         }
-      });
-    },
-    /** 删除按钮操作 */
-    handleDelete(row) {
-      this.$modal.confirm('删除部门时会删除该部门下的存储空间!是否确认删除名称为"' + row.deptName + '"的部门?').then(function() {
-        return delDept(row.deptId);
-      }).then(() => {
+        return {
+          id: node.deptId,
+          label: node.deptName,
+          children: node.children
+        };
+      },
+      // 取消按钮
+      cancel() {
+        this.open = false;
+        this.reset();
+      },
+      // 表单重置
+      reset() {
+        this.form = {
+          deptId: undefined,
+          parentId: undefined,
+          deptName: undefined,
+          orderNum: undefined,
+          leader: undefined,
+          phone: undefined,
+          email: undefined,
+          status: "0"
+        };
+        this.resetForm("form");
+      },
+      /** 搜索按钮操作 */
+      handleQuery() {
         this.getList();
-        this.$modal.msgSuccess("删除成功");
-      }).catch(() => {});
+      },
+      /** 重置按钮操作 */
+      resetQuery() {
+        this.resetForm("queryForm");
+        this.handleQuery();
+      },
+      /** 新增按钮操作 */
+      handleAdd(row) {
+        this.reset();
+        if (row != undefined) {
+          this.form.parentId = row.deptId;
+        }
+        this.open = true;
+        this.title = "添加部门";
+        listDept().then(response => {
+          this.deptOptions = this.handleTree(response.data, "deptId");
+        });
+      },
+      /** 展开/折叠操作 */
+      toggleExpandAll() {
+        this.refreshTable = false;
+        this.isExpandAll = !this.isExpandAll;
+        this.$nextTick(() => {
+          this.refreshTable = true;
+        });
+      },
+      /** 修改按钮操作 */
+      handleUpdate(row) {
+        this.reset();
+        getDept(row.deptId).then(response => {
+          this.form = response.data;
+          this.open = true;
+          this.title = "修改部门";
+        });
+        listDeptExcludeChild(row.deptId).then(response => {
+          this.deptOptions = this.handleTree(response.data, "deptId");
+        });
+      },
+      /** 提交按钮 */
+      submitForm: function() {
+        this.$refs["form"].validate(valid => {
+          if (valid) {
+            if (this.form.deptId != undefined) {
+              updateDept(this.form).then(response => {
+                this.$modal.msgSuccess("修改成功");
+                this.open = false;
+                this.getList();
+              });
+            } else {
+              addDept(this.form).then(response => {
+                this.$modal.msgSuccess("新增成功");
+                this.open = false;
+                this.getList();
+              });
+            }
+          }
+        });
+      },
+      /** 删除按钮操作 */
+      handleDelete(row) {
+        this.$modal.confirm('删除部门时会删除该部门下的存储空间!是否确认删除名称为"' + row.deptName + '"的部门?').then(function() {
+          return delDept(row.deptId);
+        }).then(() => {
+          this.getList();
+          this.$modal.msgSuccess("删除成功");
+        }).catch(() => {});
+      }
     }
-  }
-};
-</script>
+  };
+</script>