Commit 036d47c748010f0a1b748e65ed0cb66898d20719

Authored by yiming
1 parent ebd14718

库房维护初版

@@ -196,6 +196,7 @@ @@ -196,6 +196,7 @@
196 <module>ruoyi-quartz</module> 196 <module>ruoyi-quartz</module>
197 <module>ruoyi-generator</module> 197 <module>ruoyi-generator</module>
198 <module>ruoyi-common</module> 198 <module>ruoyi-common</module>
  199 + <module>ruoyi-service</module>
199 </modules> 200 </modules>
200 <packaging>pom</packaging> 201 <packaging>pom</packaging>
201 202
ruoyi-admin/pom.xml
@@ -61,6 +61,12 @@ @@ -61,6 +61,12 @@
61 <artifactId>ruoyi-generator</artifactId> 61 <artifactId>ruoyi-generator</artifactId>
62 </dependency> 62 </dependency>
63 63
  64 + <dependency>
  65 + <groupId>com.ruoyi</groupId>
  66 + <artifactId>ruoyi-service</artifactId>
  67 + <version>3.8.3</version>
  68 + </dependency>
  69 +
64 </dependencies> 70 </dependencies>
65 71
66 <build> 72 <build>
ruoyi-service/pom.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <parent>
  6 + <artifactId>ruoyi</artifactId>
  7 + <groupId>com.ruoyi</groupId>
  8 + <version>3.8.3</version>
  9 + </parent>
  10 + <modelVersion>4.0.0</modelVersion>
  11 +
  12 + <artifactId>ruoyi-service</artifactId>
  13 + <dependencies>
  14 + <dependency>
  15 + <groupId>com.ruoyi</groupId>
  16 + <artifactId>ruoyi-common</artifactId>
  17 + </dependency>
  18 + </dependencies>
  19 +
  20 + <properties>
  21 + <maven.compiler.source>8</maven.compiler.source>
  22 + <maven.compiler.target>8</maven.compiler.target>
  23 + </properties>
  24 +
  25 +</project>
0 \ No newline at end of file 26 \ No newline at end of file
ruoyi-service/src/main/java/com/ruoyi/service/controller/DepotController.java 0 → 100644
  1 +package com.ruoyi.service.controller;
  2 +
  3 +import com.alibaba.fastjson2.JSONObject;
  4 +import com.ruoyi.common.annotation.Log;
  5 +import com.ruoyi.common.constant.UserConstants;
  6 +import com.ruoyi.common.core.domain.entity.SysRole;
  7 +import com.ruoyi.common.core.domain.entity.SysUser;
  8 +import com.ruoyi.common.core.page.TableDataInfo;
  9 +import com.ruoyi.common.enums.BusinessType;
  10 +import com.ruoyi.common.utils.SecurityUtils;
  11 +import com.ruoyi.common.utils.StringUtils;
  12 +import com.ruoyi.service.domain.*;
  13 +import com.ruoyi.service.service.DepotService;
  14 +import com.ruoyi.common.core.controller.BaseController;
  15 +import com.ruoyi.common.core.domain.AjaxResult;
  16 +import com.ruoyi.common.core.domain.entity.SysDept;
  17 +import org.springframework.beans.factory.annotation.Autowired;
  18 +import org.springframework.security.access.prepost.PreAuthorize;
  19 +import org.springframework.validation.annotation.Validated;
  20 +import org.springframework.web.bind.annotation.*;
  21 +
  22 +import java.util.List;
  23 +import java.util.stream.Collectors;
  24 +
  25 +/**
  26 + * 用户信息
  27 + *
  28 + * @author ruoyi
  29 + */
  30 +@RestController
  31 +@RequestMapping("/service/depot")
  32 +public class DepotController extends BaseController
  33 +{
  34 +
  35 +
  36 + @Autowired
  37 + private DepotService depotService;
  38 +
  39 + @GetMapping("/treeselect")
  40 + public AjaxResult treeselect(SysDept dept)
  41 + {
  42 + List<Tree> tree=depotService.treeSelect();
  43 + return AjaxResult.success(tree);
  44 + }
  45 +
  46 + // @PreAuthorize("@ss.hasPermi('system:user:list')")
  47 + @GetMapping("/depotList")
  48 + public TableDataInfo depotList(Depot depot)
  49 + {
  50 + startPage();
  51 + List<Depot> list = depotService.depotList(depot);
  52 + return getDataTable(list);
  53 + }
  54 +
  55 + @GetMapping("/regionList")
  56 + public TableDataInfo regionList(Region region)
  57 + {
  58 + startPage();
  59 + List<Region> list = depotService.regionList(region);
  60 + return getDataTable(list);
  61 + }
  62 +
  63 + @GetMapping("/columnList")
  64 + public TableDataInfo columnList(Column column)
  65 + {
  66 + startPage();
  67 + List<Column> list = depotService.columnList(column);
  68 + return getDataTable(list);
  69 + }
  70 +
  71 + @GetMapping("/nodeList")
  72 + public TableDataInfo nodeList(Node node)
  73 + {
  74 + startPage();
  75 + List<Node> list = depotService.nodeList(node);
  76 + return getDataTable(list);
  77 + }
  78 +
  79 +
  80 + @PostMapping("/add")
  81 + public AjaxResult add(@Validated @RequestBody JSONObject jsonObject)
  82 + {
  83 + if(jsonObject.containsKey("depotNo")){
  84 + return depotService.addDepot(jsonObject);
  85 + }
  86 + else if(jsonObject.containsKey("regionNo")){
  87 + return depotService.addRegion(jsonObject);
  88 + }
  89 + else if(jsonObject.containsKey("columnNo")){
  90 + return depotService.addColumn(jsonObject);
  91 + }
  92 + else if(jsonObject.containsKey("nodeNo")){
  93 + return depotService.addNode(jsonObject);
  94 + }
  95 + return toAjax(0);
  96 + }
  97 +
  98 + @PostMapping("/upd")
  99 + public AjaxResult updDepot(@Validated @RequestBody JSONObject jsonObject)
  100 + {
  101 + if(jsonObject.containsKey("depotNo")){
  102 + return depotService.updDepot(jsonObject);
  103 + }
  104 + else if(jsonObject.containsKey("regionNo")){
  105 + return depotService.updRegion(jsonObject);
  106 + }
  107 + else if(jsonObject.containsKey("columnNo")){
  108 + return depotService.updColumn(jsonObject);
  109 + }
  110 + return toAjax(0);
  111 + }
  112 +
  113 +
  114 + @DeleteMapping("/delDepot/{id}")
  115 + public AjaxResult delDepot(@PathVariable Long id)
  116 + {
  117 + return toAjax(depotService.delDepot(id));
  118 + }
  119 +
  120 + @DeleteMapping("/delRegion/{id}")
  121 + public AjaxResult delRegion(@PathVariable Long id)
  122 + {
  123 + return toAjax(depotService.delRegion(id));
  124 + }
  125 +
  126 + @DeleteMapping("/deColumn/{id}")
  127 + public AjaxResult deColumn(@PathVariable Long id)
  128 + {
  129 + return toAjax(depotService.deColumn(id));
  130 + }
  131 +
  132 + @DeleteMapping("/delNode/{id}")
  133 + public AjaxResult delNode(@PathVariable Long id)
  134 + {
  135 + return toAjax(depotService.delNode(id));
  136 + }
  137 +
  138 +}
ruoyi-service/src/main/java/com/ruoyi/service/domain/Archives.java 0 → 100644
  1 +package com.ruoyi.service.domain;
  2 +
  3 +
  4 +import com.ruoyi.common.annotation.Excel;
  5 +import com.ruoyi.common.annotation.Excel.ColumnType;
  6 +import com.ruoyi.common.core.domain.BaseEntity;
  7 +
  8 +
  9 +/**
  10 + * 库房-节点 sys_job
  11 + *
  12 + * @author ym
  13 + */
  14 +public class Archives extends BaseEntity
  15 +{
  16 + private static final long serialVersionUID = 1L;
  17 +
  18 + /** 主键 */
  19 + private Long id;
  20 +
  21 + private String name;
  22 +
  23 + public Long getId() {
  24 + return id;
  25 + }
  26 +
  27 + public void setId(Long id) {
  28 + this.id = id;
  29 + }
  30 +
  31 + public String getName() {
  32 + return name;
  33 + }
  34 +
  35 + public void setName(String name) {
  36 + this.name = name;
  37 + }
  38 +}
ruoyi-service/src/main/java/com/ruoyi/service/domain/Column.java 0 → 100644
  1 +package com.ruoyi.service.domain;
  2 +
  3 +
  4 +import com.ruoyi.common.annotation.Excel;
  5 +import com.ruoyi.common.annotation.Excel.ColumnType;
  6 +import com.ruoyi.common.core.domain.BaseEntity;
  7 +
  8 +import java.util.List;
  9 +
  10 +
  11 +/**
  12 + * 库房-列 sys_job
  13 + *
  14 + * @author ym
  15 + */
  16 +public class Column extends BaseEntity
  17 +{
  18 + private static final long serialVersionUID = 1L;
  19 +
  20 + /** 主键 */
  21 + private Long id;
  22 +
  23 + /** 区域主键 */
  24 + private Long parentId;
  25 +
  26 + /** 所属区域 */
  27 + @Excel(name = "所属区域", cellType = ColumnType.STRING)
  28 + private String regionName;
  29 +
  30 + /** 密集架类型 */
  31 + @Excel(name = "type", cellType = ColumnType.NUMERIC)
  32 + private int type;
  33 +
  34 + /** 单双面 */
  35 + @Excel(name = "单双面", cellType = ColumnType.NUMERIC)
  36 + private int surfaceType;
  37 +
  38 + /** 列编号 */
  39 + @Excel(name = "列编号", cellType = ColumnType.NUMERIC)
  40 + private int columnNo;
  41 +
  42 + /** 列名称 */
  43 + @Excel(name = "列名称", cellType = ColumnType.STRING)
  44 + private String columnName;
  45 +
  46 + /** 列类型 */
  47 + @Excel(name = "列类型", cellType = ColumnType.NUMERIC)
  48 + private int columnType;
  49 +
  50 + /** 节数 */
  51 + @Excel(name = "节数", cellType = ColumnType.NUMERIC)
  52 + private int nodeSize;
  53 +
  54 + /** 节长度 */
  55 + @Excel(name = "节长度", cellType = ColumnType.NUMERIC)
  56 + private int nodeLength;
  57 +
  58 +
  59 + /** 层数 */
  60 + @Excel(name = "层数", cellType = ColumnType.NUMERIC)
  61 + private int layerSize;
  62 +
  63 + /** 层高 */
  64 + @Excel(name = "层高", cellType = ColumnType.NUMERIC)
  65 + private int layerHeight;
  66 +
  67 + /** 备注 */
  68 + @Excel(name = "备注", cellType = ColumnType.STRING)
  69 + private String mark;
  70 +
  71 + /** 子节点 */
  72 + private List<Node> nodes;
  73 +
  74 + private String name;
  75 +
  76 + public Long getId() {
  77 + return id;
  78 + }
  79 +
  80 + public void setId(Long id) {
  81 + this.id = id;
  82 + }
  83 +
  84 + public Long getParentId() {
  85 + return parentId;
  86 + }
  87 +
  88 + public void setParentId(Long parentId) {
  89 + this.parentId = parentId;
  90 + }
  91 +
  92 + public String getRegionName() {
  93 + return regionName;
  94 + }
  95 +
  96 + public void setRegionName(String regionName) {
  97 + this.regionName = regionName;
  98 + }
  99 +
  100 + public int getType() {
  101 + return type;
  102 + }
  103 +
  104 + public void setType(int type) {
  105 + this.type = type;
  106 + }
  107 +
  108 + public int getSurfaceType() {
  109 + return surfaceType;
  110 + }
  111 +
  112 + public void setSurfaceType(int surfaceType) {
  113 + this.surfaceType = surfaceType;
  114 + }
  115 +
  116 + public int getColumnNo() {
  117 + return columnNo;
  118 + }
  119 +
  120 + public void setColumnNo(int columnNo) {
  121 + this.columnNo = columnNo;
  122 + }
  123 +
  124 + public String getColumnName() {
  125 + return columnName;
  126 + }
  127 +
  128 + public void setColumnName(String columnName) {
  129 + this.columnName = columnName;
  130 + }
  131 +
  132 + public int getColumnType() {
  133 + return columnType;
  134 + }
  135 +
  136 + public void setColumnType(int columnType) {
  137 + this.columnType = columnType;
  138 + }
  139 +
  140 + public int getNodeSize() {
  141 + return nodeSize;
  142 + }
  143 +
  144 + public void setNodeSize(int nodeSize) {
  145 + this.nodeSize = nodeSize;
  146 + }
  147 +
  148 + public int getNodeLength() {
  149 + return nodeLength;
  150 + }
  151 +
  152 + public void setNodeLength(int nodeLength) {
  153 + this.nodeLength = nodeLength;
  154 + }
  155 +
  156 + public int getLayerSize() {
  157 + return layerSize;
  158 + }
  159 +
  160 + public void setLayerSize(int layerSize) {
  161 + this.layerSize = layerSize;
  162 + }
  163 +
  164 + public int getLayerHeight() {
  165 + return layerHeight;
  166 + }
  167 +
  168 + public void setLayerHeight(int layerHeight) {
  169 + this.layerHeight = layerHeight;
  170 + }
  171 +
  172 + public String getMark() {
  173 + return mark;
  174 + }
  175 +
  176 + public void setMark(String mark) {
  177 + this.mark = mark;
  178 + }
  179 +
  180 + public List<Node> getNodes() {
  181 + return nodes;
  182 + }
  183 +
  184 + public void setNodes(List<Node> nodes) {
  185 + this.nodes = nodes;
  186 + }
  187 +
  188 + public String getName() {
  189 + return columnName;
  190 + }
  191 +
  192 + public void setName(String name) {
  193 + this.name = columnName;
  194 + }
  195 +}
ruoyi-service/src/main/java/com/ruoyi/service/domain/Depot.java 0 → 100644
  1 +package com.ruoyi.service.domain;
  2 +
  3 +
  4 +import com.ruoyi.common.annotation.Excel;
  5 +import com.ruoyi.common.annotation.Excel.ColumnType;
  6 +import com.ruoyi.common.core.domain.BaseEntity;
  7 +
  8 +import java.util.List;
  9 +
  10 +
  11 +/**
  12 + * 库房-节点 sys_job
  13 + *
  14 + * @author ym
  15 + */
  16 +public class Depot extends BaseEntity
  17 +{
  18 + private static final long serialVersionUID = 1L;
  19 +
  20 + /** 主键 */
  21 + private Long id;
  22 +
  23 + /** 公司 */
  24 + @Excel(name = "公司编号", cellType = ColumnType.NUMERIC)
  25 + private int parentId;
  26 +
  27 + /** 库房编号 */
  28 + @Excel(name = "库房编号", cellType = ColumnType.NUMERIC)
  29 + private int depotNo;
  30 +
  31 + /** 库房名称 */
  32 + @Excel(name = "库房名称", cellType = ColumnType.STRING)
  33 + private String depotName;
  34 +
  35 +
  36 +
  37 + /** 备注 */
  38 + @Excel(name = "备注", cellType = ColumnType.STRING)
  39 + private String mark;
  40 +
  41 + /** 子分区 */
  42 + private List<Region> regions;
  43 +
  44 + private String name;
  45 +
  46 + public Long getId() {
  47 + return id;
  48 + }
  49 +
  50 + public void setId(Long id) {
  51 + this.id = id;
  52 + }
  53 +
  54 + public int getParentId() {
  55 + return parentId;
  56 + }
  57 +
  58 + public void setParentId(int parentId) {
  59 + this.parentId = parentId;
  60 + }
  61 +
  62 + public String getDepotName() {
  63 + return depotName;
  64 + }
  65 +
  66 + public void setDepotName(String depotName) {
  67 + this.depotName = depotName;
  68 + }
  69 +
  70 + public String getMark() {
  71 + return mark;
  72 + }
  73 +
  74 + public void setMark(String mark) {
  75 + this.mark = mark;
  76 + }
  77 +
  78 + public List<Region> getRegions() {
  79 + return regions;
  80 + }
  81 +
  82 + public void setRegions(List<Region> regions) {
  83 + this.regions = regions;
  84 + }
  85 +
  86 + public String getName() {
  87 + return name=depotName;
  88 + }
  89 +
  90 + public void setName(String name) {
  91 + this.name = depotName;
  92 + }
  93 +
  94 + public int getDepotNo() {
  95 + return depotNo;
  96 + }
  97 +
  98 + public void setDepotNo(int depotNo) {
  99 + this.depotNo = depotNo;
  100 + }
  101 +}
ruoyi-service/src/main/java/com/ruoyi/service/domain/Node.java 0 → 100644
  1 +package com.ruoyi.service.domain;
  2 +
  3 +
  4 +import com.ruoyi.common.annotation.Excel;
  5 +import com.ruoyi.common.core.domain.BaseEntity;
  6 +import com.ruoyi.common.annotation.Excel.ColumnType;
  7 +
  8 +
  9 +/**
  10 + * 库房-节点 sys_job
  11 + *
  12 + * @author ym
  13 + */
  14 +public class Node extends BaseEntity
  15 +{
  16 + private static final long serialVersionUID = 1L;
  17 +
  18 + /** 主键 */
  19 + private Long id;
  20 +
  21 + /** 列主键 */
  22 + private Long parentId;
  23 +
  24 + /** AB面 */
  25 + @Excel(name = "AB面", cellType = ColumnType.STRING)
  26 + private String surface;
  27 +
  28 + /** 节编号 */
  29 + @Excel(name = "节编号", cellType = ColumnType.NUMERIC)
  30 + private int nodeNo;
  31 +
  32 + /** 层编号 */
  33 + @Excel(name = "层编号", cellType = ColumnType.NUMERIC)
  34 + private int layerNo;
  35 +
  36 + /** 层位号 */
  37 + @Excel(name = "层位号", cellType = ColumnType.STRING)
  38 + private String layerCode;
  39 +
  40 + /** 库位号 */
  41 + @Excel(name = "库位号", cellType = ColumnType.STRING)
  42 + private String depotCode;
  43 +
  44 + /** 备注 */
  45 + @Excel(name = "备注", cellType = ColumnType.STRING)
  46 + private String mark;
  47 +
  48 + private String name;
  49 +
  50 + public Long getId() {
  51 + return id;
  52 + }
  53 +
  54 + public void setId(Long id) {
  55 + this.id = id;
  56 + }
  57 +
  58 + public Long getParentId() {
  59 + return parentId;
  60 + }
  61 +
  62 + public void setParentId(Long parentId) {
  63 + this.parentId = parentId;
  64 + }
  65 +
  66 + public String getSurface() {
  67 + return surface;
  68 + }
  69 +
  70 + public void setSurface(String surface) {
  71 + this.surface = surface;
  72 + }
  73 +
  74 + public int getNodeNo() {
  75 + return nodeNo;
  76 + }
  77 +
  78 + public void setNodeNo(int nodeNo) {
  79 + this.nodeNo = nodeNo;
  80 + }
  81 +
  82 + public int getLayerNo() {
  83 + return layerNo;
  84 + }
  85 +
  86 + public void setLayerNo(int layerNo) {
  87 + this.layerNo = layerNo;
  88 + }
  89 +
  90 + public String getLayerCode() {
  91 + return layerCode;
  92 + }
  93 +
  94 + public void setLayerCode(String layerCode) {
  95 + this.layerCode = layerCode;
  96 + }
  97 +
  98 + public String getDepotCode() {
  99 + return depotCode;
  100 + }
  101 +
  102 + public void setDepotCode(String depotCode) {
  103 + this.depotCode = depotCode;
  104 + }
  105 +
  106 + public String getMark() {
  107 + return mark;
  108 + }
  109 +
  110 + public void setMark(String mark) {
  111 + this.mark = mark;
  112 + }
  113 +
  114 + public String getName() {
  115 + return name=depotCode;
  116 + }
  117 +
  118 + public void setName(String name) {
  119 + this.name = depotCode;
  120 + }
  121 +}
ruoyi-service/src/main/java/com/ruoyi/service/domain/Region.java 0 → 100644
  1 +package com.ruoyi.service.domain;
  2 +
  3 +
  4 +import com.ruoyi.common.annotation.Excel;
  5 +import com.ruoyi.common.annotation.Excel.ColumnType;
  6 +import com.ruoyi.common.core.domain.BaseEntity;
  7 +
  8 +import java.util.List;
  9 +
  10 +
  11 +/**
  12 + * 库房-分区 sys_job
  13 + *
  14 + * @author ym
  15 + */
  16 +public class Region extends BaseEntity
  17 +{
  18 + private static final long serialVersionUID = 1L;
  19 +
  20 + /** 主键 */
  21 + private Long id;
  22 +
  23 + /** 库主键 */
  24 + private Long parentId;
  25 +
  26 + /** 分区编号 */
  27 + @Excel(name = "分区编号", cellType = ColumnType.NUMERIC)
  28 + private int regionNo;
  29 +
  30 + /** 分区名称 */
  31 + @Excel(name = "分区名称", cellType = ColumnType.STRING)
  32 + private String regionName;
  33 +
  34 + /** 密集架数量 */
  35 + @Excel(name = "密集架数量", cellType = ColumnType.NUMERIC)
  36 + private int columnSize;
  37 +
  38 + /** 分区描述 */
  39 + @Excel(name = "分区描述", cellType = ColumnType.STRING)
  40 + private String mark;
  41 +
  42 + /** 子列 */
  43 + private List<Column> columns;
  44 +
  45 + private String name;
  46 +
  47 + public Long getId() {
  48 + return id;
  49 + }
  50 +
  51 + public void setId(Long id) {
  52 + this.id = id;
  53 + }
  54 +
  55 + public Long getParentId() {
  56 + return parentId;
  57 + }
  58 +
  59 + public void setParentId(Long parentId) {
  60 + this.parentId = parentId;
  61 + }
  62 +
  63 + public int getRegionNo() {
  64 + return regionNo;
  65 + }
  66 +
  67 + public void setRegionNo(int regionNo) {
  68 + this.regionNo = regionNo;
  69 + }
  70 +
  71 + public String getRegionName() {
  72 + return regionName;
  73 + }
  74 +
  75 + public void setRegionName(String regionName) {
  76 + this.regionName = regionName;
  77 + }
  78 +
  79 + public int getColumnSize() {
  80 + return columnSize;
  81 + }
  82 +
  83 + public void setColumnSize(int columnSize) {
  84 + this.columnSize = columnSize;
  85 + }
  86 +
  87 + public String getMark() {
  88 + return mark;
  89 + }
  90 +
  91 + public void setMark(String mark) {
  92 + this.mark = mark;
  93 + }
  94 +
  95 + public List<Column> getColumns() {
  96 + return columns;
  97 + }
  98 +
  99 + public void setColumns(List<Column> columns) {
  100 + this.columns = columns;
  101 + }
  102 +
  103 + public String getName() {
  104 + return name=regionName;
  105 + }
  106 +
  107 + public void setName(String name) {
  108 + this.name = regionName;
  109 + }
  110 +}
ruoyi-service/src/main/java/com/ruoyi/service/domain/Tree.java 0 → 100644
  1 +package com.ruoyi.service.domain;
  2 +
  3 +
  4 +import com.ruoyi.common.annotation.Excel;
  5 +import com.ruoyi.common.annotation.Excel.ColumnType;
  6 +import com.ruoyi.common.core.domain.BaseEntity;
  7 +import com.ruoyi.common.core.domain.entity.SysDept;
  8 +
  9 +import java.lang.reflect.Method;
  10 +import java.util.ArrayList;
  11 +import java.util.List;
  12 +import java.util.Objects;
  13 +
  14 +
  15 +/**
  16 + * 库房-列 sys_job
  17 + *
  18 + * @author ym
  19 + */
  20 +public class Tree extends BaseEntity
  21 +{
  22 + private static final long serialVersionUID = 1L;
  23 +
  24 + private int level;
  25 +
  26 + private Long dbId;
  27 +
  28 + private String id;
  29 +
  30 + private String parentId;
  31 +
  32 + private String label;
  33 +
  34 + private List<Tree> children = new ArrayList<Tree>();
  35 +
  36 + public Tree() {
  37 + }
  38 +
  39 + public Tree(int level, Long dbId, String id, String parentId, String label) {
  40 + this.level = level;
  41 + this.dbId = dbId;
  42 + this.id = id;
  43 + this.parentId = parentId;
  44 + this.label = label;
  45 + }
  46 +
  47 + public int getLevel() {
  48 + return level;
  49 + }
  50 +
  51 + public void setLevel(int level) {
  52 + this.level = level;
  53 + }
  54 +
  55 + public Long getDbId() {
  56 + return dbId;
  57 + }
  58 +
  59 + public void setDbId(Long dbId) {
  60 + this.dbId = dbId;
  61 + }
  62 +
  63 + public String getId() {
  64 + return id;
  65 + }
  66 +
  67 + public void setId(String id) {
  68 + this.id = id;
  69 + }
  70 +
  71 + public String getParentId() {
  72 + return parentId;
  73 + }
  74 +
  75 + public void setParentId(String parentId) {
  76 + this.parentId = parentId;
  77 + }
  78 +
  79 + public String getLabel() {
  80 + return label;
  81 + }
  82 +
  83 + public void setLabel(String label) {
  84 + this.label = label;
  85 + }
  86 +
  87 + public List<Tree> getChildren() {
  88 + return children;
  89 + }
  90 +
  91 + public void setChildren(List<Tree> children) {
  92 + this.children = children;
  93 + }
  94 +
  95 + @Override
  96 + public boolean equals(Object o) {
  97 + if (this == o) return true;
  98 + if (o == null || getClass() != o.getClass()) return false;
  99 + Tree tree = (Tree) o;
  100 + return level == tree.level && Objects.equals(id, tree.id) && Objects.equals(parentId, tree.parentId) && Objects.equals(label, tree.label);
  101 + }
  102 +
  103 + @Override
  104 + public int hashCode() {
  105 + return Objects.hash(level, id, parentId, label);
  106 + }
  107 +}
ruoyi-service/src/main/java/com/ruoyi/service/mapper/DepotMapper.java 0 → 100644
  1 +package com.ruoyi.service.mapper;
  2 +
  3 +import com.ruoyi.service.domain.*;
  4 +
  5 +import java.util.List;
  6 +
  7 +/**
  8 + * 部门管理 数据层
  9 + *
  10 + * @author ruoyi
  11 + */
  12 +public interface DepotMapper
  13 +{
  14 + List<Archives> selectArchivesAll();
  15 + List<Depot> selectDepot(Depot depot);
  16 + List<Column> selectColumn(Column column);
  17 + List<Region> selectRegion(Region region);
  18 + List<Node> selectNode(Node node);
  19 + int checkDepotNameUnique(Depot depot);
  20 + int checkDepotNoUnique(Depot depot);
  21 + int insertDepot(Depot depot);
  22 + int insertRegion(Region region);
  23 + int insertColumn(Column column);
  24 + int insertNode(Node node);
  25 + int updateDepot(Depot depot);
  26 + int updateRegion(Region region);
  27 + int updateColumn(Column column);
  28 + int delDepot(Long id);
  29 + int delRegion(Long id);
  30 + int deColumn(Long id);
  31 + int delNode(Long id);
  32 + Depot getDepot(Depot depot);
  33 +}
ruoyi-service/src/main/java/com/ruoyi/service/service/DepotService.java 0 → 100644
  1 +package com.ruoyi.service.service;
  2 +
  3 +import com.alibaba.fastjson2.JSONObject;
  4 +import com.ruoyi.common.core.domain.AjaxResult;
  5 +import com.ruoyi.service.domain.*;
  6 +
  7 +import java.util.List;
  8 +
  9 +/**
  10 + * 部门管理 服务层
  11 + *
  12 + * @author ruoyi
  13 + */
  14 +public interface DepotService
  15 +{
  16 +
  17 + List<Tree> treeSelect();
  18 +
  19 + List<Depot> depotList(Depot depot);
  20 +
  21 + List<Region> regionList(Region region);
  22 +
  23 + List<Column> columnList(Column column);
  24 +
  25 + List<Node> nodeList(Node node);
  26 +
  27 + AjaxResult addDepot(JSONObject jsonObject);
  28 +
  29 + AjaxResult addRegion(JSONObject jsonObject);
  30 +
  31 + AjaxResult addColumn(JSONObject jsonObject);
  32 +
  33 + AjaxResult addNode(JSONObject jsonObject);
  34 +
  35 + AjaxResult updDepot(JSONObject jsonObject);
  36 +
  37 + AjaxResult updRegion(JSONObject jsonObject);
  38 +
  39 + AjaxResult updColumn(JSONObject jsonObject);
  40 +
  41 + int delDepot(Long id);
  42 +
  43 + int delRegion(Long id);
  44 +
  45 + int deColumn(Long id);
  46 +
  47 + int delNode(Long id);
  48 +
  49 +
  50 +}
ruoyi-service/src/main/java/com/ruoyi/service/service/impl/DepotServiceImpl.java 0 → 100644
  1 +package com.ruoyi.service.service.impl;
  2 +
  3 +import com.alibaba.fastjson2.JSONObject;
  4 +import com.ruoyi.common.constant.UserConstants;
  5 +import com.ruoyi.common.core.domain.AjaxResult;
  6 +import com.ruoyi.common.core.domain.entity.SysDept;
  7 +import com.ruoyi.common.utils.StringUtils;
  8 +import com.ruoyi.service.domain.*;
  9 +import com.ruoyi.service.mapper.DepotMapper;
  10 +import com.ruoyi.service.service.DepotService;
  11 +import org.springframework.beans.factory.annotation.Autowired;
  12 +import org.springframework.stereotype.Service;
  13 +
  14 +import javax.annotation.Resource;
  15 +import java.util.*;
  16 +
  17 +
  18 +/**
  19 + * 部门管理 服务实现
  20 + *
  21 + * @author ruoyi
  22 + */
  23 +@Service
  24 +public class DepotServiceImpl implements DepotService
  25 +{
  26 + @Resource
  27 + private DepotMapper depotMapper;
  28 +
  29 + @Override
  30 + public List<Tree> treeSelect(){
  31 + Set<Tree> set=new HashSet<>();
  32 + List<Archives> archives=depotMapper.selectArchivesAll();
  33 + archives.forEach(archive -> {
  34 + String id="a"+archive.getId();
  35 + Tree tree=new Tree(0,archive.getId(),id,"0",archive.getName());
  36 + set.add(tree);
  37 + });
  38 +
  39 + List<Depot> depots=depotMapper.selectDepot(null);
  40 + depots.forEach(depot -> {
  41 + String id="d"+depot.getId();
  42 + String parentId="a"+depot.getParentId();
  43 + Tree tree=new Tree(1,depot.getId(),id,parentId,depot.getName());
  44 + set.add(tree);
  45 + });
  46 + List<Region> regions=depotMapper.selectRegion(null);
  47 + regions.forEach(region -> {
  48 + String id="r"+region.getId();
  49 + String parentId="d"+region.getParentId();
  50 + Tree tree=new Tree(2,region.getId(),id,parentId,region.getRegionName());
  51 + set.add(tree);
  52 + });
  53 + List<Column> columns=depotMapper.selectColumn(null);
  54 + columns.forEach(column -> {
  55 + String id="c"+column.getId();
  56 + String parentId="r"+column.getParentId();
  57 + Tree tree=new Tree(3,column.getId(),id,parentId,column.getColumnName());
  58 + set.add(tree);
  59 + });
  60 + List<Node> nodes=depotMapper.selectNode(null);
  61 + nodes.forEach(node -> {
  62 + //AB面
  63 + String id="s"+node.getParentId()+"-"+node.getSurface();
  64 + String parentId="c"+node.getParentId();
  65 + Tree tree=new Tree(4,node.getId(),id,parentId,String.valueOf(node.getSurface()));
  66 + set.add(tree);
  67 + //节
  68 + String id2=id+"-"+node.getNodeNo();
  69 + String parentId2=id;
  70 + tree=new Tree(5,node.getId(),id2,parentId2,"节"+node.getNodeNo());
  71 + set.add(tree);
  72 + //层
  73 + String id3=id2+"-"+node.getLayerNo();
  74 + String parentId3=id2;
  75 + tree=new Tree(6,node.getId(),id3,parentId3,node.getDepotCode());
  76 + set.add(tree);
  77 + });
  78 + List<Tree> list=new ArrayList<>();
  79 + set.forEach(tree -> {
  80 + list.add(tree);
  81 + });
  82 + List<Tree> treeList =buildTree(list);
  83 + return treeList;
  84 + }
  85 +
  86 + @Override
  87 + public List<Depot> depotList(Depot depot){
  88 + return depotMapper.selectDepot(depot);
  89 + }
  90 +
  91 + @Override
  92 + public List<Region> regionList(Region region){
  93 + return depotMapper.selectRegion(region);
  94 + }
  95 +
  96 + @Override
  97 + public List<Column> columnList(Column column){
  98 + return depotMapper.selectColumn(column);
  99 + }
  100 +
  101 + @Override
  102 + public List<Node> nodeList(Node node){
  103 + return depotMapper.selectNode(node);
  104 + }
  105 +
  106 + @Override
  107 + public AjaxResult addDepot(JSONObject jsonObject){
  108 + Depot depot=JSONObject.parseObject(jsonObject.toJSONString(),Depot.class);
  109 + if (depotMapper.checkDepotNoUnique(depot)>0)
  110 + {
  111 + return AjaxResult.error("新增库房失败,编号已存在");
  112 + }
  113 + else if (depotMapper.checkDepotNameUnique(depot)>0)
  114 + {
  115 + return AjaxResult.error("新增库房失败,库房名称已存在");
  116 + }
  117 + return toAjax(depotMapper.insertDepot(depot));
  118 + }
  119 +
  120 + @Override
  121 + public AjaxResult addRegion(JSONObject jsonObject){
  122 + Region region=JSONObject.parseObject(jsonObject.toJSONString(),Region.class);
  123 + return toAjax(depotMapper.insertRegion(region));
  124 + }
  125 +
  126 + @Override
  127 + public AjaxResult addColumn(JSONObject jsonObject){
  128 + Column column=JSONObject.parseObject(jsonObject.toJSONString(),Column.class);
  129 + return toAjax(depotMapper.insertColumn(column));
  130 + }
  131 +
  132 + @Override
  133 + public AjaxResult addNode(JSONObject jsonObject){
  134 + Node node=JSONObject.parseObject(jsonObject.toJSONString(),Node.class);
  135 + String layerCode=node.getSurface()+"-"+node.getNodeNo()+"-"+node.getLayerNo();
  136 + node.setLayerCode(layerCode);
  137 + Column column=new Column();
  138 + column.setId(node.getParentId());
  139 + column=depotMapper.selectColumn(column).get(0);
  140 + Region region=new Region();
  141 + region.setId(column.getParentId());
  142 + region=depotMapper.selectRegion(region).get(0);
  143 + Depot depot=new Depot();
  144 + depot.setId(region.getParentId());
  145 + depot=depotMapper.selectDepot(depot).get(0);
  146 + String depotCode=depot.getDepotNo()+"-"+region.getRegionNo()+"-"+column.getColumnNo()+"-"+layerCode;
  147 + node.setDepotCode(depotCode);
  148 + return toAjax(depotMapper.insertNode(node));
  149 + }
  150 +
  151 + @Override
  152 + public AjaxResult updDepot(JSONObject jsonObject){
  153 + Depot depot=JSONObject.parseObject(jsonObject.toJSONString(),Depot.class);
  154 + if (depotMapper.checkDepotNoUnique(depot)>0)
  155 + {
  156 + return AjaxResult.error("修改库房失败,编号已存在");
  157 + }
  158 + else if (depotMapper.checkDepotNameUnique(depot)>0)
  159 + {
  160 + return AjaxResult.error("修改库房失败,库房名称已存在");
  161 + }
  162 + return toAjax(depotMapper.updateDepot(depot));
  163 + }
  164 +
  165 + @Override
  166 + public AjaxResult updRegion(JSONObject jsonObject){
  167 + Region region=JSONObject.parseObject(jsonObject.toJSONString(),Region.class);
  168 + return toAjax(depotMapper.updateRegion(region));
  169 + }
  170 +
  171 + @Override
  172 + public AjaxResult updColumn(JSONObject jsonObject){
  173 + Column column=JSONObject.parseObject(jsonObject.toJSONString(),Column.class);
  174 + return toAjax(depotMapper.updateColumn(column));
  175 + }
  176 +
  177 + @Override
  178 + public int delDepot(Long id){
  179 + return depotMapper.delDepot(id);
  180 + }
  181 +
  182 + @Override
  183 + public int delRegion(Long id){
  184 + return depotMapper.delRegion(id);
  185 + }
  186 +
  187 + @Override
  188 + public int deColumn(Long id){
  189 + return depotMapper.deColumn(id);
  190 + }
  191 +
  192 + @Override
  193 + public int delNode(Long id){
  194 + return depotMapper.delNode(id);
  195 + }
  196 +
  197 +
  198 + public List<Tree> buildTree(List<Tree> treeList)
  199 + {
  200 + List<Tree> returnList = new ArrayList<>();
  201 + List<String> tempList = new ArrayList<>();
  202 + for (Tree tree : treeList)
  203 + {
  204 + tempList.add(tree.getId());
  205 + }
  206 + for (Tree tree : treeList)
  207 + {
  208 + // 如果是顶级节点, 遍历该父节点的所有子节点
  209 + if (!tempList.contains(tree.getParentId()))
  210 + {
  211 + recursionFn(treeList, tree);
  212 + returnList.add(tree);
  213 + }
  214 + }
  215 + if (returnList.isEmpty())
  216 + {
  217 + returnList = treeList;
  218 + }
  219 + return returnList;
  220 + }
  221 +
  222 + private void recursionFn(List<Tree> list, Tree t)
  223 + {
  224 + // 得到子节点列表
  225 + List<Tree> childList = getChildList(list, t);
  226 + t.setChildren(childList);
  227 + for (Tree tChild : childList)
  228 + {
  229 + if (hasChild(list, tChild))
  230 + {
  231 + recursionFn(list, tChild);
  232 + }
  233 + }
  234 + }
  235 +
  236 + private List<Tree> getChildList(List<Tree> list, Tree t)
  237 + {
  238 + List<Tree> tlist = new ArrayList<>();
  239 + Iterator<Tree> it = list.iterator();
  240 + while (it.hasNext())
  241 + {
  242 + Tree n = it.next();
  243 + if (StringUtils.isNotNull(n.getParentId()) && n.getParentId().equals(t.getId()))
  244 + {
  245 + tlist.add(n);
  246 + }
  247 + }
  248 + return tlist;
  249 + }
  250 +
  251 + /**
  252 + * 判断是否有子节点
  253 + */
  254 + private boolean hasChild(List<Tree> list, Tree t)
  255 + {
  256 + return getChildList(list, t).size() > 0;
  257 + }
  258 +
  259 + protected AjaxResult toAjax(int rows)
  260 + {
  261 + return rows > 0 ? AjaxResult.success() : AjaxResult.error();
  262 + }
  263 +}
ruoyi-service/src/main/resources/mapper/sevice/DepotMapper.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8" ?>
  2 +<!DOCTYPE mapper
  3 +PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4 +"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5 +<mapper namespace="com.ruoyi.service.mapper.DepotMapper">
  6 +
  7 + <select id="selectArchivesAll" resultType="com.ruoyi.service.domain.Archives">
  8 + select * from archives
  9 + </select>
  10 +
  11 + <select id="selectDepot" parameterType="com.ruoyi.service.domain.Depot" resultType="com.ruoyi.service.domain.Depot">
  12 + select * from depot
  13 + <where>
  14 + <if test="id != null and id != ''">
  15 + AND id =#{id}
  16 + </if>
  17 + <if test="parentId != null and parentId != ''">
  18 + AND parentId =#{parentId}
  19 + </if>
  20 + </where>
  21 + </select>
  22 +
  23 + <select id="selectRegion" parameterType="com.ruoyi.service.domain.Region" resultType="com.ruoyi.service.domain.Region">
  24 + select * from depot_region
  25 + <where>
  26 + <if test="id != null and id != ''">
  27 + AND id =#{id}
  28 + </if>
  29 + <if test="parentId != null and parentId != ''">
  30 + AND parentId =#{parentId}
  31 + </if>
  32 + </where>
  33 + </select>
  34 +
  35 + <select id="selectColumn" resultType="com.ruoyi.service.domain.Column" parameterType="com.ruoyi.service.domain.Column">
  36 + select * from depot_column
  37 + <where>
  38 + <if test="id != null and id != ''">
  39 + AND id =#{id}
  40 + </if>
  41 + <if test="parentId != null and parentId != ''">
  42 + AND parentId =#{parentId}
  43 + </if>
  44 + </where>
  45 + </select>
  46 +
  47 + <select id="selectNode" resultType="com.ruoyi.service.domain.Node" parameterType="com.ruoyi.service.domain.Node">
  48 + select * from depot_node
  49 + <where>
  50 + <if test="id != null and id != ''">
  51 + AND id =#{id}
  52 + </if>
  53 + <if test="parentId != null and parentId != ''">
  54 + AND parentId =#{parentId}
  55 + </if>
  56 + <if test="surface != null and surface != ''">
  57 + AND surface =#{surface}
  58 + </if>
  59 + <if test="nodeNo != null and nodeNo != ''">
  60 + AND nodeNo =#{nodeNo}
  61 + </if>
  62 + <if test="layerNo != null and layerNo != ''">
  63 + AND layerNo =#{layerNo}
  64 + </if>
  65 + </where>
  66 + </select>
  67 +
  68 + <select id="checkDepotNameUnique" parameterType="com.ruoyi.service.domain.Depot" resultType="int">
  69 + select count(1) from depot where depotName = #{depotName}
  70 + <if test="id != null and id != ''"> and id != #{id}</if>
  71 + limit 1
  72 + </select>
  73 +
  74 + <select id="checkDepotNoUnique" parameterType="com.ruoyi.service.domain.Depot" resultType="int">
  75 + select count(1) from depot where depotNo = #{depotNo}
  76 + <if test="id != null and id != ''"> and id != #{id}</if>
  77 + limit 1
  78 + </select>
  79 +
  80 + <insert id="insertDepot" parameterType="com.ruoyi.service.domain.Depot">
  81 + insert into depot(
  82 + <if test="parentId != null and parentId != ''">parentId,</if>
  83 + <if test="depotNo != null and depotNo != ''">depotNo,</if>
  84 + <if test="depotName != null and depotName != ''">depotName,</if>
  85 + <if test="mark != null and mark != ''">mark,</if>
  86 + createTime
  87 + )values(
  88 + <if test="parentId != null and parentId != ''">#{parentId},</if>
  89 + <if test="depotNo != null and depotNo != ''">#{depotNo},</if>
  90 + <if test="depotName != null and depotName != ''">#{depotName},</if>
  91 + <if test="mark != null and mark != ''">#{mark},</if>
  92 + sysdate()
  93 + )
  94 + </insert>
  95 +
  96 + <insert id="insertRegion" parameterType="com.ruoyi.service.domain.Region">
  97 + insert into depot_region(
  98 + <if test="parentId != null and parentId != ''">parentId,</if>
  99 + <if test="regionNo != null and regionNo != ''">regionNo,</if>
  100 + <if test="regionName != null and regionName != ''">regionName,</if>
  101 + <if test="columnSize != null and columnSize != ''">columnSize,</if>
  102 + <if test="mark != null and mark != ''">mark,</if>
  103 + createTime
  104 + )values(
  105 + <if test="parentId != null and parentId != ''">#{parentId},</if>
  106 + <if test="regionNo != null and regionNo != ''">#{regionNo},</if>
  107 + <if test="regionName != null and regionName != ''">#{regionName},</if>
  108 + <if test="columnSize != null and columnSize != ''">#{columnSize},</if>
  109 + <if test="mark != null and mark != ''">#{mark},</if>
  110 + sysdate()
  111 + )
  112 + </insert>
  113 +
  114 + <insert id="insertColumn" parameterType="com.ruoyi.service.domain.Column">
  115 + insert into depot_column(
  116 + <if test="parentId != null and parentId != ''">parentId,</if>
  117 + <if test="regionName != null and regionName != ''">regionName,</if>
  118 + <if test="type != null and type != ''">type,</if>
  119 + <if test="surfaceType != null and surfaceType != ''">surfaceType,</if>
  120 + <if test="columnNo != null and columnNo != ''">columnNo,</if>
  121 + <if test="columnName != null and columnName != ''">columnName,</if>
  122 + <if test="columnType != null and columnType != ''">columnType,</if>
  123 + <if test="nodeSize != null and nodeSize != ''">nodeSize,</if>
  124 + <if test="nodeLength != null and nodeLength != ''">nodeLength,</if>
  125 + <if test="layerSize != null and layerSize != ''">layerSize,</if>
  126 + <if test="layerHeight != null and layerHeight != ''">layerHeight,</if>
  127 + <if test="mark != null and mark != ''">mark,</if>
  128 + createTime
  129 + )values(
  130 + <if test="parentId != null and parentId != ''">#{parentId},</if>
  131 + <if test="regionName != null and regionName != ''">#{regionName},</if>
  132 + <if test="type != null and type != ''">#{type},</if>
  133 + <if test="surfaceType != null and surfaceType != ''">#{surfaceType},</if>
  134 + <if test="columnNo != null and columnNo != ''">#{columnNo},</if>
  135 + <if test="columnName != null and columnName != ''">#{columnName},</if>
  136 + <if test="columnType != null and columnType != ''">#{columnType},</if>
  137 + <if test="nodeSize != null and nodeSize != ''">#{nodeSize},</if>
  138 + <if test="nodeLength != null and nodeLength != ''">#{nodeLength},</if>
  139 + <if test="layerSize != null and layerSize != ''">#{layerSize},</if>
  140 + <if test="layerHeight != null and layerHeight != ''">#{layerHeight},</if>
  141 + <if test="mark != null and mark != ''">#{mark},</if>
  142 + sysdate()
  143 + )
  144 + </insert>
  145 +
  146 + <insert id="insertNode" parameterType="com.ruoyi.service.domain.Node">
  147 + insert into depot_node(
  148 + <if test="parentId != null and parentId != ''">parentId,</if>
  149 + <if test="surface != null and surface != ''">surface,</if>
  150 + <if test="nodeNo != null and nodeNo != ''">nodeNo,</if>
  151 + <if test="layerNo != null and layerNo != ''">layerNo,</if>
  152 + <if test="layerCode != null and layerCode != ''">layerCode,</if>
  153 + <if test="depotCode != null and depotCode != ''">depotCode,</if>
  154 + <if test="mark != null and mark != ''">mark,</if>
  155 + createTime
  156 + )values(
  157 + <if test="parentId != null and parentId != ''">#{parentId},</if>
  158 + <if test="surface != null and surface != ''">#{surface},</if>
  159 + <if test="nodeNo != null and nodeNo != ''">#{nodeNo},</if>
  160 + <if test="layerNo != null and layerNo != ''">#{layerNo},</if>
  161 + <if test="layerCode != null and layerCode != ''">#{layerCode},</if>
  162 + <if test="depotCode != null and depotCode != ''">#{depotCode},</if>
  163 + <if test="mark != null and mark != ''">#{mark},</if>
  164 + sysdate()
  165 + )
  166 + </insert>
  167 +
  168 +
  169 +
  170 + <update id="updateDepot" parameterType="com.ruoyi.service.domain.Depot">
  171 + update depot
  172 + <set>
  173 + <if test="depotName != null and depotName != ''">depotName = #{depotName},</if>
  174 + <if test="mark != null">mark = #{mark},</if>
  175 + updateTime = sysdate()
  176 + </set>
  177 + where id = #{id}
  178 + </update>
  179 +
  180 + <update id="updateRegion" parameterType="com.ruoyi.service.domain.Region">
  181 + update depot_region
  182 + <set>
  183 + <if test="columnSize != null and columnSize != ''">columnSize = #{columnSize},</if>
  184 + <if test="mark != null">mark = #{mark},</if>
  185 + updateTime = sysdate()
  186 + </set>
  187 + where id = #{id}
  188 + </update>
  189 +
  190 + <update id="updateColumn" parameterType="com.ruoyi.service.domain.Column">
  191 + update depot_column
  192 + <set>
  193 + <if test="type != null and type != ''">type = #{type},</if>
  194 + <if test="surfaceType != null and surfaceType != ''">surfaceType = #{surfaceType},</if>
  195 + <if test="columnName != null and columnName != ''">columnName = #{columnName},</if>
  196 + <if test="columnType != null and columnType != ''">columnType = #{columnType},</if>
  197 + <if test="nodeSize != null and nodeSize != ''">nodeSize = #{nodeSize},</if>
  198 + <if test="nodeLength != null and nodeLength != ''">nodeLength = #{nodeLength},</if>
  199 + <if test="layerSize != null and layerSize != ''">layerSize = #{layerSize},</if>
  200 + <if test="layerHeight != null and layerHeight != ''">layerHeight = #{layerHeight},</if>
  201 + <if test="mark != null">mark = #{mark},</if>
  202 + updateTime = sysdate()
  203 + </set>
  204 + where id = #{id}
  205 + </update>
  206 +
  207 +
  208 + <select id="getDepot" resultType="com.ruoyi.service.domain.Depot" parameterType="com.ruoyi.service.domain.Depot">
  209 + select * from depot
  210 + <where>
  211 + <if test="id != null and id != ''">
  212 + AND id = #{id}
  213 + </if>
  214 + </where>
  215 + </select>
  216 +
  217 + <delete id="delDepot" parameterType="Long">
  218 + delete from depot where id = #{id}
  219 + </delete>
  220 +
  221 + <delete id="delRegion" parameterType="Long">
  222 + delete from depot_region where id = #{id}
  223 + </delete>
  224 +
  225 + <delete id="delColumn" parameterType="Long">
  226 + delete from depot_column where id = #{id}
  227 + </delete>
  228 +
  229 + <delete id="delNode" parameterType="Long">
  230 + delete from depot_node where id = #{id}
  231 + </delete>
  232 +
  233 +
  234 +</mapper>
0 \ No newline at end of file 235 \ No newline at end of file
ruoyi-ui/src/api/service/depot.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +import {parseStrEmpty} from "@/utils/ruoyi";
  3 +
  4 +
  5 +// 查询库房树结构
  6 +export function treeselect() {
  7 + return request({
  8 + url: '/service/depot/treeselect',
  9 + method: 'get'
  10 + })
  11 +}
  12 +
  13 +// 查询库房列表
  14 +export function depotList(query) {
  15 + return request({
  16 + url: '/service/depot/depotList',
  17 + method: 'get',
  18 + params: query
  19 + })
  20 +}
  21 +
  22 +// 查询分区
  23 +export function regionList(query) {
  24 + return request({
  25 + url: '/service/depot/regionList',
  26 + method: 'get',
  27 + params: query
  28 + })
  29 +}
  30 +
  31 +// 查询列
  32 +export function columnList(query) {
  33 + return request({
  34 + url: '/service/depot/columnList',
  35 + method: 'get',
  36 + params: query
  37 + })
  38 +}
  39 +
  40 +// 查询节点
  41 +export function nodeList(query) {
  42 + return request({
  43 + url: '/service/depot/nodeList',
  44 + method: 'get',
  45 + params: query
  46 + })
  47 +}
  48 +
  49 +export function add(data) {
  50 + return request({
  51 + url: '/service/depot/add',
  52 + method: 'post',
  53 + data: data
  54 + })
  55 +}
  56 +
  57 +export function upd(data) {
  58 + return request({
  59 + url: '/service/depot/upd',
  60 + method: 'post',
  61 + data: data
  62 + })
  63 +}
  64 +
  65 +
  66 +export function delDepot(id) {
  67 + return request({
  68 + url: '/service/depot/delDepot/' + id,
  69 + method: 'delete'
  70 + })
  71 +}
  72 +export function delRegion(id) {
  73 + return request({
  74 + url: '/service/depot/delRegion/' + id,
  75 + method: 'delete'
  76 + })
  77 +}
  78 +
  79 +export function delColumn(id) {
  80 + return request({
  81 + url: '/service/depot/deColumn/' + id,
  82 + method: 'delete'
  83 + })
  84 +}
  85 +
  86 +export function delNode(id) {
  87 + return request({
  88 + url: '/service/depot/delNode/' + id,
  89 + method: 'delete'
  90 + })
  91 +}
  92 +
  93 +export function getDepot(id) {
  94 + return request({
  95 + url: '/service/depot/' + parseStrEmpty(id),
  96 + method: 'get'
  97 + })
  98 +}
  99 +
  100 +
  101 +
  102 +// 查询部门列表
  103 +export function listDept(query) {
  104 + return request({
  105 + url: '/system/dept/list',
  106 + method: 'get',
  107 + params: query
  108 + })
  109 +}
  110 +
  111 +// 查询部门列表(排除节点)
  112 +export function listDeptExcludeChild(deptId) {
  113 + return request({
  114 + url: '/system/dept/list/exclude/' + deptId,
  115 + method: 'get'
  116 + })
  117 +}
  118 +
  119 +// 查询部门详细
  120 +export function getDept(deptId) {
  121 + return request({
  122 + url: '/system/dept/' + deptId,
  123 + method: 'get'
  124 + })
  125 +}
  126 +
  127 +
  128 +
  129 +// 根据角色ID查询部门树结构
  130 +export function roleDeptTreeselect(roleId) {
  131 + return request({
  132 + url: '/system/dept/roleDeptTreeselect/' + roleId,
  133 + method: 'get'
  134 + })
  135 +}
  136 +
  137 +// 新增部门
  138 +export function addDept(data) {
  139 + return request({
  140 + url: '/system/dept',
  141 + method: 'post',
  142 + data: data
  143 + })
  144 +}
  145 +
  146 +// 修改部门
  147 +export function updateDept(data) {
  148 + return request({
  149 + url: '/system/dept',
  150 + method: 'put',
  151 + data: data
  152 + })
  153 +}
  154 +
  155 +// 删除部门
  156 +export function delDept(deptId) {
  157 + return request({
  158 + url: '/system/dept/' + deptId,
  159 + method: 'delete'
  160 + })
  161 +}
ruoyi-ui/src/views/service/depot/index.vue 0 → 100644
  1 +<template>
  2 + <div class="app-container">
  3 + <el-row :gutter="20">
  4 + <!--部门数据-->
  5 + <el-col :span="4" :xs="24">
  6 + <div class="head-container">
  7 + <el-tree
  8 + :data="options"
  9 + :props="defaultProps"
  10 + :expand-on-click-node="false"
  11 + :filter-node-method="filterNode"
  12 + :default-expand-all=true
  13 + node-key="id"
  14 + ref="tree"
  15 + highlight-current
  16 + @node-click="handleNodeClick"
  17 + />
  18 + </div>
  19 + </el-col>
  20 + <!--库房-->
  21 + <el-col :span="20" :xs="24" v-if="level==0" >
  22 + <el-row :gutter="10" class="mb8">
  23 + <el-col :span="1.5">
  24 + <el-button
  25 + type="primary"
  26 + plain
  27 + icon="el-icon-plus"
  28 + size="mini"
  29 + @click="handleAdd"
  30 + v-hasPermi="['server:depot:add']"
  31 + >新增</el-button>
  32 + </el-col>
  33 + <el-col :span="1.5">
  34 + <el-button
  35 + type="danger"
  36 + plain
  37 + icon="el-icon-delete"
  38 + size="mini"
  39 + :disabled="multiple"
  40 + @click="handleDelete"
  41 + v-hasPermi="['server:depot:remove']"
  42 + >删除</el-button>
  43 + </el-col>
  44 + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
  45 + </el-row>
  46 +
  47 + <el-table v-loading="loading" :data="depotList" @selection-change="handleSelectionChange">
  48 + <el-table-column type="selection" width="50" align="center" />
  49 + <el-table-column label="库房名称" align="center" key="depotName" prop="depotName" v-if="columns[0].visible" />
  50 + <el-table-column label="库房编号" align="center" key="depotNo" prop="depotNo" v-if="columns[1].visible" :show-overflow-tooltip="true" />
  51 + <el-table-column label="备注" align="center" key="mark" prop="mark" v-if="columns[2].visible" :show-overflow-tooltip="true" />
  52 + <el-table-column
  53 + label="操作"
  54 + align="center"
  55 + width="160"
  56 + class-name="small-padding fixed-width"
  57 + >
  58 + <template slot-scope="scope" v-if="scope.row.userId !== 1">
  59 + <el-button
  60 + size="mini"
  61 + type="text"
  62 + icon="el-icon-edit"
  63 + @click="handleUpdate(scope.row)"
  64 + v-hasPermi="['system:user:edit']"
  65 + >修改</el-button>
  66 + <el-button
  67 + size="mini"
  68 + type="text"
  69 + icon="el-icon-delete"
  70 + @click="handleDelete(scope.row)"
  71 + v-hasPermi="['system:user:remove']"
  72 + >删除</el-button>
  73 + </template>
  74 + </el-table-column>
  75 + </el-table>
  76 +
  77 + <pagination
  78 + v-show="total>0"
  79 + :total="total"
  80 + :page.sync="queryParams.pageNum"
  81 + :limit.sync="queryParams.pageSize"
  82 + @pagination="getList"
  83 + />
  84 + </el-col>
  85 + <!--区域-->
  86 + <el-col :span="20" :xs="24" v-if="level==1">
  87 + <el-row :gutter="10" class="mb8">
  88 + <el-col :span="1.5">
  89 + <el-button
  90 + type="primary"
  91 + plain
  92 + icon="el-icon-plus"
  93 + size="mini"
  94 + @click="handleAdd"
  95 + v-hasPermi="['system:user:add']"
  96 + >新增</el-button>
  97 + </el-col>
  98 + <el-col :span="1.5">
  99 + <el-button
  100 + type="danger"
  101 + plain
  102 + icon="el-icon-delete"
  103 + size="mini"
  104 + :disabled="multiple"
  105 + @click="handleDelete"
  106 + v-hasPermi="['system:user:remove']"
  107 + >删除</el-button>
  108 + </el-col>
  109 + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
  110 + </el-row>
  111 +
  112 + <el-table v-loading="loading" :data="regionList" @selection-change="handleSelectionChange">
  113 + <el-table-column type="selection" width="50" align="center" />
  114 + <el-table-column label="分区编号" align="center" key="regionNo" prop="regionNo" v-if="columns[0].visible" />
  115 + <el-table-column label="密集架数量" align="center" key="columnSize" prop="columnSize" v-if="columns[1].visible" :show-overflow-tooltip="true" />
  116 + <el-table-column label="分区描述" align="center" key="mark" prop="mark" v-if="columns[2].visible" :show-overflow-tooltip="true" />
  117 + <el-table-column
  118 + label="操作"
  119 + align="center"
  120 + width="160"
  121 + class-name="small-padding fixed-width"
  122 + >
  123 + <template slot-scope="scope" >
  124 + <el-button
  125 + size="mini"
  126 + type="text"
  127 + icon="el-icon-edit"
  128 + @click="handleUpdate(scope.row)"
  129 + v-hasPermi="['system:user:edit']"
  130 + >修改</el-button>
  131 + <el-button
  132 + size="mini"
  133 + type="text"
  134 + icon="el-icon-delete"
  135 + @click="handleDelete(scope.row)"
  136 + v-hasPermi="['system:user:remove']"
  137 + >删除</el-button>
  138 + </template>
  139 + </el-table-column>
  140 + </el-table>
  141 +
  142 + <pagination
  143 + v-show="total>0"
  144 + :total="total"
  145 + :page.sync="queryParams.pageNum"
  146 + :limit.sync="queryParams.pageSize"
  147 + @pagination="getList"
  148 + />
  149 + </el-col>
  150 + <!--列-->
  151 + <el-col :span="20" :xs="24" v-if="level==2">
  152 + <el-row :gutter="10" class="mb8">
  153 + <el-col :span="1.5">
  154 + <el-button
  155 + type="primary"
  156 + plain
  157 + icon="el-icon-plus"
  158 + size="mini"
  159 + @click="handleAdd"
  160 + v-hasPermi="['system:user:add']"
  161 + >新增</el-button>
  162 + </el-col>
  163 + <el-col :span="1.5">
  164 + <el-button
  165 + type="success"
  166 + plain
  167 + icon="el-icon-edit"
  168 + size="mini"
  169 + :disabled="single"
  170 + @click="handleUpdate"
  171 + v-hasPermi="['system:user:edit']"
  172 + >修改</el-button>
  173 + </el-col>
  174 + <el-col :span="1.5">
  175 + <el-button
  176 + type="danger"
  177 + plain
  178 + icon="el-icon-delete"
  179 + size="mini"
  180 + :disabled="multiple"
  181 + @click="handleDelete"
  182 + v-hasPermi="['system:user:remove']"
  183 + >删除</el-button>
  184 + </el-col>
  185 + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
  186 + </el-row>
  187 +
  188 + <el-table v-loading="loading" :data="columnList" @selection-change="handleSelectionChange">
  189 + <el-table-column type="selection" width="50" align="center" />
  190 + <el-table-column label="所属区域" align="center" key="regionName" prop="regionName" v-if="columns[0].visible" />
  191 + <el-table-column label="密集架类型" align="center" key="type" prop="type" v-if="columns[1].visible" :show-overflow-tooltip="true" />
  192 + <el-table-column label="单双面选择" align="center" key="surfaceType" prop="surfaceType" v-if="columns[2].visible" :show-overflow-tooltip="true" />
  193 + <el-table-column label="列编号" align="center" key="columnNo" prop="columnNo" v-if="columns[3].visible" />
  194 + <el-table-column label="列名称" align="center" key="columnName" prop="columnName" v-if="columns[4].visible" />
  195 + <el-table-column label="列类型" align="center" key="columnType" prop="columnType" v-if="columns[5].visible" />
  196 + <el-table-column label="节数" align="center" key="nodeSize" prop="nodeSize" v-if="columns[6].visible" />
  197 + <el-table-column label="节长度" align="center" key="nodeLength" prop="nodeLength" v-if="columns[6].visible" />
  198 + <el-table-column label="层数" align="center" key="layerSize" prop="layerSize" v-if="columns[6].visible" />
  199 + <el-table-column label="层高" align="center" key="layerHeight" prop="layerHeight" v-if="columns[6].visible" />
  200 + <el-table-column label="备注" align="center" key="mark" prop="mark" v-if="columns[6].visible" />
  201 + <el-table-column
  202 + label="操作"
  203 + align="center"
  204 + width="160"
  205 + class-name="small-padding fixed-width"
  206 + >
  207 + <template slot-scope="scope" v-if="scope.row.userId !== 1">
  208 + <el-button
  209 + size="mini"
  210 + type="text"
  211 + icon="el-icon-edit"
  212 + @click="handleUpdate(scope.row)"
  213 + v-hasPermi="['system:user:edit']"
  214 + >修改</el-button>
  215 + <el-button
  216 + size="mini"
  217 + type="text"
  218 + icon="el-icon-delete"
  219 + @click="handleDelete(scope.row)"
  220 + v-hasPermi="['system:user:remove']"
  221 + >删除</el-button>
  222 + </template>
  223 + </el-table-column>
  224 + </el-table>
  225 +
  226 + <pagination
  227 + v-show="total>0"
  228 + :total="total"
  229 + :page.sync="queryParams.pageNum"
  230 + :limit.sync="queryParams.pageSize"
  231 + @pagination="getList"
  232 + />
  233 + </el-col>
  234 + <!--节点-->
  235 + <el-col :span="20" :xs="24" v-if="level>=3">
  236 + <el-row :gutter="10" class="mb8">
  237 + <el-col :span="1.5">
  238 + <el-button
  239 + type="primary"
  240 + plain
  241 + icon="el-icon-plus"
  242 + size="mini"
  243 + @click="handleAdd"
  244 + v-hasPermi="['system:user:add']"
  245 + >新增</el-button>
  246 + </el-col>
  247 + <el-col :span="1.5">
  248 + <el-button
  249 + type="danger"
  250 + plain
  251 + icon="el-icon-delete"
  252 + size="mini"
  253 + :disabled="multiple"
  254 + @click="handleDelete"
  255 + v-hasPermi="['system:user:remove']"
  256 + >删除</el-button>
  257 + </el-col>
  258 + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList" :columns="columns"></right-toolbar>
  259 + </el-row>
  260 +
  261 + <el-table v-loading="loading" :data="nodeList" @selection-change="handleSelectionChange">
  262 + <el-table-column type="selection" width="50" align="center" />
  263 + <el-table-column label="AB面" align="center" key="surface" prop="surface" v-if="columns[0].visible" />
  264 + <el-table-column label="节编号" align="center" key="nodeNo" prop="nodeNo" v-if="columns[1].visible" :show-overflow-tooltip="true" />
  265 + <el-table-column label="层编号" align="center" key="layerNo" prop="layerNo" v-if="columns[2].visible" :show-overflow-tooltip="true" />
  266 + <el-table-column label="层位码" align="center" key="layerCode" prop="layerCode" v-if="columns[3].visible" />
  267 + <el-table-column label="库位号" align="center" key="depotCode" prop="depotCode" v-if="columns[4].visible" />
  268 + <el-table-column label="备注" align="center" key="mark" prop="mark" v-if="columns[5].visible" />
  269 + <el-table-column
  270 + label="操作"
  271 + align="center"
  272 + width="160"
  273 + class-name="small-padding fixed-width"
  274 + >
  275 + <template slot-scope="scope" v-if="scope.row.userId !== 1">
  276 + <el-button
  277 + size="mini"
  278 + type="text"
  279 + icon="el-icon-delete"
  280 + @click="handleDelete(scope.row)"
  281 + v-hasPermi="['system:user:remove']"
  282 + >删除</el-button>
  283 + </template>
  284 + </el-table-column>
  285 + </el-table>
  286 +
  287 + <pagination
  288 + v-show="total>0"
  289 + :total="total"
  290 + :page.sync="queryParams.pageNum"
  291 + :limit.sync="queryParams.pageSize"
  292 + @pagination="getList"
  293 + />
  294 + </el-col>
  295 + </el-row>
  296 +
  297 + <!-- 添加或修改用户配置对话框 -->
  298 + <el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
  299 + <el-form ref="form" :model="form" :rules="rules" label-width="100px">
  300 +
  301 + <div v-if="level==0">
  302 + <el-form-item label="库房编号" prop="depotNo" >
  303 + <el-input-number v-model="form.depotNo" controls-position="right" :min="0" :disabled="edit" />
  304 + </el-form-item>
  305 + <el-form-item label="库房名称" prop="depotName">
  306 + <el-input v-model="form.depotName" maxlength="20" />
  307 + </el-form-item>
  308 + <el-form-item label="库房描述" prop="mark">
  309 + <el-input v-model="form.mark" maxlength="30" />
  310 + </el-form-item>
  311 + </div>
  312 +
  313 + <div v-if="level==1">
  314 + <el-form-item label="分区编号" prop="regionNo">
  315 + <el-input-number v-model="form.regionNo" controls-position="right" :min="0" :disabled="edit" />
  316 + </el-form-item>
  317 + <el-form-item label="分区名称" prop="regionName">
  318 + <el-input v-model="form.regionName" maxlength="20" />
  319 + </el-form-item>
  320 + <el-form-item label="密集架数量" prop="columnSize">
  321 + <el-input-number v-model="form.columnSize" controls-position="right" :min="0" />
  322 + </el-form-item>
  323 + <el-form-item label="分区描述" prop="mark">
  324 + <el-input v-model="form.mark" maxlength="30" />
  325 + </el-form-item>
  326 + </div>
  327 +
  328 + <div v-if="level==2">
  329 + <el-form-item label="所属区域" prop="regionName">
  330 + <el-select v-model="form.regionName" placeholder="请选择" :disabled="edit">
  331 + <el-option
  332 + v-for="item in regionOptions"
  333 + :key="item"
  334 + :label="item"
  335 + :value="item">
  336 + </el-option>
  337 + </el-select>
  338 + </el-form-item>
  339 + <el-form-item label="密集架类型" prop="type">
  340 + <el-select v-model="form.type" placeholder="请选类型">
  341 + <el-option label="类型1" value="1"></el-option>
  342 + <el-option label="类型2" value="2"></el-option>
  343 + </el-select>
  344 + </el-form-item>
  345 + <el-form-item label="单双面" prop="surfaceType">
  346 + <el-select v-model="form.surfaceType" placeholder="请选类型">
  347 + <el-option label="单" value="1"></el-option>
  348 + <el-option label="双" value="2"></el-option>
  349 + </el-select>
  350 + </el-form-item>
  351 + <el-form-item label="列编号" prop="columnNo">
  352 + <el-input-number v-model="form.columnNo" controls-position="right" :min="0" :disabled="edit" />
  353 + </el-form-item>
  354 + <el-form-item label="名称" prop="columnName">
  355 + <el-input v-model="form.columnName" maxlength="30" />
  356 + </el-form-item>
  357 + <el-form-item label="列类型" prop="columnType">
  358 + <el-select v-model="form.columnType" placeholder="请选类型">
  359 + <el-option label="类型1" value="1"></el-option>
  360 + <el-option label="类型2" value="2"></el-option>
  361 + </el-select>
  362 + </el-form-item>
  363 + <el-form-item label="节数" prop="nodeSize">
  364 + <el-input-number v-model="form.nodeSize" controls-position="right" :min="0" />
  365 + </el-form-item>
  366 + <el-form-item label="节长度" prop="nodeLength">
  367 + <el-input-number v-model="form.nodeLength" controls-position="right" :min="0" />
  368 + </el-form-item>
  369 + <el-form-item label="层数" prop="layerSize">
  370 + <el-input-number v-model="form.layerSize" controls-position="right" :min="0" />
  371 + </el-form-item>
  372 + <el-form-item label="层高" prop="layerHeight">
  373 + <el-input-number v-model="form.layerHeight" controls-position="right" :min="0" />
  374 + </el-form-item>
  375 + <el-form-item label="备注" prop="mark">
  376 + <el-input v-model="form.mark" maxlength="30" />
  377 + </el-form-item>
  378 + </div>
  379 +
  380 + <div v-if="level>=3">
  381 + <el-form-item label="AB面" prop="surface">
  382 + <el-select v-model="form.surface" placeholder="请选类型">
  383 + <el-option label="A" value="A"></el-option>
  384 + <el-option label="B" value="B"></el-option>
  385 + </el-select>
  386 + </el-form-item>
  387 + <el-form-item label="节编号" prop="nodeNo">
  388 + <el-input-number v-model="form.nodeNo" controls-position="right" :min="0" />
  389 + </el-form-item>
  390 + <el-form-item label="层编号" prop="layerNo">
  391 + <el-input-number v-model="form.layerNo" controls-position="right" :min="0" />
  392 + </el-form-item>
  393 + <el-form-item label="备注" prop="mark">
  394 + <el-input v-model="form.mark" maxlength="30" />
  395 + </el-form-item>
  396 + </div>
  397 +
  398 + <el-input v-model="form.id" v-show="false" />
  399 + </el-form>
  400 + <div slot="footer" class="dialog-footer">
  401 + <el-button type="primary" @click="submitForm">确 定</el-button>
  402 + <el-button @click="cancel">取 消</el-button>
  403 + </div>
  404 + </el-dialog>
  405 +
  406 + </div>
  407 +</template>
  408 +
  409 +<script>
  410 +import { listUser, getUser, delUser, addUser, updateUser, resetUserPwd, changeUserStatus } from "@/api/system/user";
  411 +import { getToken } from "@/utils/auth";
  412 +import {
  413 + add,
  414 + columnList, delColumn, delDepot, delNode, delRegion,
  415 + depotList,
  416 + nodeList,
  417 + regionList,
  418 + treeselect, upd, updDepot
  419 +} from "@/api/service/depot";
  420 +import Treeselect from "@riophae/vue-treeselect";
  421 +import "@riophae/vue-treeselect/dist/vue-treeselect.css";
  422 +
  423 +export default {
  424 + name: "User",
  425 + dicts: ['sys_normal_disable', 'sys_user_sex'],
  426 + components: { Treeselect },
  427 + data() {
  428 + return {
  429 + //控制显示不同的table
  430 + depotTable:true,
  431 + regionTable:false,
  432 + columnTable:false,
  433 + nodeTable:false,
  434 + depotList: null,
  435 + regionList: null,
  436 + columnList: null,
  437 + nodeList: null,
  438 + //判断树的层级
  439 + level:0,
  440 + parentId:undefined,
  441 + id:undefined,
  442 + edit:false,
  443 + form: {},
  444 + regionOptions: [],
  445 + surfaceOptions: [],
  446 + // 遮罩层
  447 + loading: true,
  448 + // 选中数组
  449 + ids: [],
  450 + // 非单个禁用
  451 + single: true,
  452 + // 非多个禁用
  453 + multiple: true,
  454 + // 显示搜索条件
  455 + showSearch: true,
  456 + // 总条数
  457 + total: 0,
  458 + // 弹出层标题
  459 + title: "",
  460 + // 部门树选项
  461 + options: undefined,
  462 + // 是否显示弹出层
  463 + open: false,
  464 + // 表单参数
  465 + defaultProps: {
  466 + children: "children",
  467 + label: "label"
  468 + },
  469 + // 查询参数
  470 + queryParams: {
  471 + pageNum: 1,
  472 + pageSize: 10,
  473 + level:undefined,
  474 + id:undefined,
  475 + parentId:undefined,
  476 + surface:undefined,
  477 + nodeNo:undefined,
  478 + layerNo:undefined
  479 + },
  480 + // 列信息
  481 + columns: [
  482 + { key: 0, label: ``, visible: true },
  483 + { key: 1, label: ``, visible: true },
  484 + { key: 2, label: ``, visible: true },
  485 + { key: 3, label: ``, visible: true },
  486 + { key: 4, label: ``, visible: true },
  487 + { key: 5, label: ``, visible: true },
  488 + { key: 6, label: ``, visible: true }
  489 + ],
  490 + // 表单校验
  491 + rules: {
  492 + depotNo: [
  493 + { required: true, message: "库房编号不能为空", trigger: "blur" }
  494 + ],
  495 + depotName: [
  496 + { required: true, message: "库房名称不能为空", trigger: "blur" }
  497 + ],
  498 + regionNo: [
  499 + { required: true, message: "分区编号不能为空", trigger: "blur" }
  500 + ],
  501 + regionName: [
  502 + { required: true, message: "分区名称不能为空", trigger: "blur" }
  503 + ],
  504 + columnSize: [
  505 + { required: true, message: "密集架数量数量不能为空", trigger: "blur" }
  506 + ],
  507 + type: [
  508 + { required: true, message: "密集架类型不能为空", trigger: "blur" }
  509 + ],
  510 + surfaceType: [
  511 + { required: true, message: "单双面不能为空", trigger: "blur" }
  512 + ],
  513 + columnNo: [
  514 + { required: true, message: "列编号不能为空", trigger: "blur" }
  515 + ],
  516 + columnName: [
  517 + { required: true, message: "列名称不能为空", trigger: "blur" }
  518 + ],
  519 + columnType: [
  520 + { required: true, message: "列类型不能为空", trigger: "blur" }
  521 + ],
  522 + nodeSize: [
  523 + { required: true, message: "节数不能为空", trigger: "blur" }
  524 + ],
  525 + nodeLength: [
  526 + { required: true, message: "节长不能为空", trigger: "blur" }
  527 + ],
  528 + layerSize: [
  529 + { required: true, message: "层高不能为空", trigger: "blur" }
  530 + ],
  531 + surface: [
  532 + { required: true, message: "AB面不能为空", trigger: "blur" }
  533 + ],
  534 + nodeNo: [
  535 + { required: true, message: "节编号不能为空", trigger: "blur" }
  536 + ],
  537 + layerNo: [
  538 + { required: true, message: "层编号不能为空", trigger: "blur" }
  539 + ]
  540 + }
  541 + };
  542 + },
  543 + watch: {
  544 + // 根据名称筛选部门树
  545 + deptName(val) {
  546 + this.$refs.tree.filter(val);
  547 + }
  548 + },
  549 + created() {
  550 + this.getList();
  551 + this.getTreeselect();
  552 + this.getConfigKey("sys.user.initPassword").then(response => {
  553 + this.initPassword = response.msg;
  554 + });
  555 + },
  556 + methods: {
  557 + /** 查询用户列表 */
  558 + getList() {
  559 + this.loading = true;
  560 + if (this.level==0){
  561 + depotList(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  562 + this.depotList = response.rows;
  563 + this.total = response.total;
  564 + this.loading = false;
  565 + }
  566 + )
  567 + }else if (this.level==1){
  568 + regionList(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  569 + this.regionList = response.rows;
  570 + this.total = response.total;
  571 + this.loading = false;
  572 + }
  573 + )
  574 + }
  575 + else if (this.level==2){
  576 + columnList(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  577 + this.columnList = response.rows;
  578 + this.total = response.total;
  579 + this.loading = false;
  580 + }
  581 + )
  582 + }
  583 + else if (this.level>=3){
  584 + nodeList(this.addDateRange(this.queryParams, this.dateRange)).then(response => {
  585 + this.nodeList = response.rows;
  586 + this.total = response.total;
  587 + this.loading = false;
  588 + }
  589 + )
  590 + }
  591 +
  592 + },
  593 + /** 查询部门下拉树结构 */
  594 + getTreeselect() {
  595 + treeselect().then(response => {
  596 + this.options = response.data;
  597 + let id=response.data[0].id;
  598 + this.parentId=id.substring(1,id.length);
  599 + });
  600 + },
  601 + // 筛选节点
  602 + filterNode(value, data) {
  603 + if (!value) return true;
  604 + return data.label.indexOf(value) !== -1;
  605 + },
  606 + // 节点单击事件
  607 + handleNodeClick(data) {
  608 + console.log(this.parentId);
  609 + this.clearParams();
  610 + this.level=data.level;//等级
  611 + if(this.level>=0 && this.level<3){
  612 + this.queryParams.parentId =data.dbId;
  613 + this.parentId=data.dbId;
  614 + }
  615 + if(this.level==2){//根据区域选择密集架类型动态生成下拉菜单
  616 + let arr=this.$refs.tree.getNode( data.id).parent.childNodes;
  617 + let arr2= [];
  618 + for (let i=0;i<arr.length;i++) {
  619 + arr2[i]=arr[i].data.label;
  620 + }
  621 + this.regionOptions=arr2;
  622 + }
  623 + //因为AB面层节是一条数据 选择的时候需要根据等级生成查询条件
  624 + let arr=data.id.substring(1,data.id.length).split("-");
  625 + if(this.level>=3){
  626 + this.queryParams.parentId =arr[0];
  627 + this.parentId=arr[0];
  628 + }
  629 + if(this.level>=4){
  630 + this.queryParams.surface=arr[1];
  631 + }
  632 + if(this.level>=5){
  633 + this.queryParams.nodeNo=arr[2];
  634 + }
  635 + if(this.level==6){
  636 + this.queryParams.layerNo=arr[3];
  637 + }
  638 +
  639 + this.handleQuery();
  640 + },
  641 + // 用户状态修改
  642 + handleStatusChange(row) {
  643 + let text = row.status === "0" ? "启用" : "停用";
  644 + this.$modal.confirm('确认要"' + text + '""' + row.userName + '"用户吗?').then(function() {
  645 + return changeUserStatus(row.userId, row.status);
  646 + }).then(() => {
  647 + this.$modal.msgSuccess(text + "成功");
  648 + }).catch(function() {
  649 + row.status = row.status === "0" ? "1" : "0";
  650 + });
  651 + },
  652 + // 取消按钮
  653 + cancel() {
  654 + this.open = false;
  655 + this.reset();
  656 + },
  657 + // 表单重置
  658 + reset() {
  659 + this.form = {
  660 + id: undefined,
  661 + depotNo: undefined,
  662 + depotName: undefined,
  663 + remark: undefined,
  664 + regionNo: undefined,
  665 + regionName: undefined,
  666 + surfaceType: undefined,
  667 + columnNo: undefined,
  668 + columnName: undefined,
  669 + columnType: undefined,
  670 + nodeSize: undefined,
  671 + nodeLength: undefined,
  672 + layerSize: undefined,
  673 + surface: undefined,
  674 + nodeNo: undefined,
  675 + layerNo: undefined,
  676 + columnSize: undefined
  677 + };
  678 + this.resetForm("form");
  679 + },
  680 + /** 搜索按钮操作 */
  681 + handleQuery() {
  682 + this.queryParams.pageNum = 1;
  683 + this.getList();
  684 + },
  685 + /** 重置按钮操作 */
  686 + resetQuery() {
  687 + this.dateRange = [];
  688 + this.resetForm("queryForm");
  689 + this.handleQuery();
  690 + },
  691 + // 多选框选中数据
  692 + handleSelectionChange(selection) {
  693 + this.ids = selection.map(item => item.userId);
  694 + this.single = selection.length != 1;
  695 + this.multiple = !selection.length;
  696 + },
  697 + /** 新增按钮操作 */
  698 + handleAdd() {
  699 + this.reset();
  700 + this.open = true;
  701 + this.edit = false;
  702 + this.title = "创建库房";
  703 + },
  704 + /** 修改按钮操作 */
  705 + handleUpdate(row) {
  706 + this.reset();
  707 + this.form = row;
  708 + this.open = true;
  709 + this.edit = true;
  710 + this.title = "编辑库房";
  711 + },
  712 + /** 提交按钮 */
  713 + submitForm: function() {
  714 + this.$refs["form"].validate(valid => {
  715 + if (valid) {
  716 + this.form.parentId=this.parentId;
  717 + let id=this.form.id;
  718 + if(id==undefined){//新增
  719 + add(this.form).then(response => {
  720 + this.$modal.msgSuccess("新增成功");
  721 + this.open = false;
  722 + this.getList();
  723 + this.getTreeselect();
  724 + });
  725 + }else {//修改
  726 + upd(this.form).then(response => {
  727 + this.$modal.msgSuccess("修改成功");
  728 + this.open = false;
  729 + this.getList();
  730 + this.getTreeselect();
  731 + });
  732 + }
  733 + }
  734 + });
  735 + },
  736 + /** 删除按钮操作 */
  737 + handleDelete(row) {
  738 + let level=this.level
  739 + this.$modal.confirm('是否确认删除').then(function() {
  740 + if (level==0){
  741 + return delDepot(row.id);
  742 + }
  743 + else if (level==1){
  744 + return delRegion(row.id);
  745 + }
  746 + else if (level==2){
  747 + return delColumn(row.id);
  748 + }
  749 + else if (level>=3){
  750 + return delNode(row.id);
  751 + }
  752 + }).then(() => {
  753 + this.getList();
  754 + this.$modal.msgSuccess("删除成功");
  755 + this.getTreeselect();
  756 + }).catch(() => {});
  757 + },
  758 + clearParams(){
  759 + this.queryParams.id =undefined;
  760 + this.queryParams.parentId =undefined;
  761 + this.queryParams.surface =undefined;
  762 + this.queryParams.layerNo =undefined;
  763 + this.queryParams.nodeNo =undefined;
  764 + }
  765 + }
  766 +};
  767 +</script>