Commit da0cc35ea2c5ce3f1f22749040d23a24729d8471

Authored by yiming
1 parent 036d47c7

库房盘点初版

ruoyi-service/src/main/java/com/ruoyi/service/controller/DepotController.java
@@ -23,7 +23,7 @@ import java.util.List; @@ -23,7 +23,7 @@ import java.util.List;
23 import java.util.stream.Collectors; 23 import java.util.stream.Collectors;
24 24
25 /** 25 /**
26 - * 用户信息 26 + * 库房维护
27 * 27 *
28 * @author ruoyi 28 * @author ruoyi
29 */ 29 */
@@ -135,4 +135,13 @@ public class DepotController extends BaseController @@ -135,4 +135,13 @@ public class DepotController extends BaseController
135 return toAjax(depotService.delNode(id)); 135 return toAjax(depotService.delNode(id));
136 } 136 }
137 137
  138 + @GetMapping("/getDepots")
  139 + public AjaxResult getDepots()
  140 + {
  141 + AjaxResult ajax = AjaxResult.success();
  142 + List<Depot> list = depotService.depotList(null);
  143 + ajax.put("depotOptions",list);
  144 + return ajax;
  145 + }
  146 +
138 } 147 }
ruoyi-service/src/main/java/com/ruoyi/service/controller/InventoryController.java 0 → 100644
  1 +package com.ruoyi.service.controller;
  2 +
  3 +
  4 +import com.ruoyi.common.annotation.Log;
  5 +import com.ruoyi.common.constant.UserConstants;
  6 +import com.ruoyi.common.core.controller.BaseController;
  7 +import com.ruoyi.common.core.domain.AjaxResult;
  8 +import com.ruoyi.common.core.domain.entity.SysDictData;
  9 +import com.ruoyi.common.core.domain.entity.SysRole;
  10 +import com.ruoyi.common.core.domain.model.LoginUser;
  11 +import com.ruoyi.common.core.page.TableDataInfo;
  12 +import com.ruoyi.common.enums.BusinessType;
  13 +import com.ruoyi.common.utils.StringUtils;
  14 +import com.ruoyi.service.domain.Inventory;
  15 +import com.ruoyi.service.service.DepotService;
  16 +import com.ruoyi.service.service.InventoryService;
  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 javax.annotation.Resource;
  23 +import java.util.List;
  24 +
  25 +
  26 +/**
  27 + * 库房盘点
  28 + *
  29 + * @author ym
  30 + */
  31 +@RestController
  32 +@RequestMapping("/service/inventory")
  33 +public class InventoryController extends BaseController
  34 +{
  35 +
  36 + @Resource
  37 + private InventoryService inventoryService;
  38 +
  39 + @PreAuthorize("@ss.hasPermi('service:inventory:add')")
  40 + @Log(title = "库房盘点", businessType = BusinessType.INSERT)
  41 + @PostMapping
  42 + public AjaxResult add(@Validated @RequestBody Inventory inventory)
  43 + {
  44 + String factory=inventory.getSelectType1()+"&"+inventory.getSelectType2()+"&"+inventory.getSelectType3();
  45 + inventory.setFactor(factory);
  46 + return toAjax(inventoryService.insert(inventory));
  47 + }
  48 +
  49 +
  50 + @PreAuthorize("@ss.hasPermi('service:inventory:edit')")
  51 + @Log(title = "库房盘点", businessType = BusinessType.UPDATE)
  52 + @PutMapping
  53 + public AjaxResult edit(@Validated @RequestBody Inventory inventory)
  54 + {
  55 + if (inventoryService.update(inventory) > 0)
  56 + {
  57 + return AjaxResult.success();
  58 + }
  59 + return AjaxResult.error("编辑失败,请联系管理员");
  60 + }
  61 +
  62 + @PreAuthorize("@ss.hasPermi('service:inventory:remove')")
  63 + @Log(title = "库房盘点", businessType = BusinessType.DELETE)
  64 + @DeleteMapping("/{id}")
  65 + public AjaxResult remove(@PathVariable Long id)
  66 + {
  67 + inventoryService.delete(id);
  68 + return success();
  69 + }
  70 +
  71 + @PreAuthorize("@ss.hasPermi('service:inventory:list')")
  72 + @GetMapping("/list")
  73 + public TableDataInfo list(Inventory inventory)
  74 + {
  75 + startPage();
  76 + List<Inventory> list = inventoryService.selectList(inventory);
  77 + return getDataTable(list);
  78 + }
  79 +
  80 +}
ruoyi-service/src/main/java/com/ruoyi/service/domain/Inventory.java 0 → 100644
  1 +package com.ruoyi.service.domain;
  2 +
  3 +
  4 +import com.fasterxml.jackson.annotation.JsonFormat;
  5 +import com.ruoyi.common.annotation.Excel;
  6 +import com.ruoyi.common.core.domain.BaseEntity;
  7 +
  8 +import java.util.Date;
  9 +
  10 +
  11 +/**
  12 + * 库房盘点
  13 + *
  14 + * @author ym
  15 + */
  16 +public class Inventory extends BaseEntity
  17 +{
  18 + private static final long serialVersionUID = 1L;
  19 +
  20 + /** 主键 */
  21 + private Long id;
  22 +
  23 + /** 档案库主键 */
  24 + private Long depotId;
  25 +
  26 + /** 档案库名称 */
  27 + private String depotName;
  28 +
  29 + /** 档案级别 */
  30 + @Excel(name = "档案级别", cellType = Excel.ColumnType.NUMERIC)
  31 + private int archivesLevel;
  32 +
  33 + /** 条件 */
  34 + @Excel(name = "条件", cellType = Excel.ColumnType.STRING)
  35 + private String factor;
  36 +
  37 + /** 任务描述 */
  38 + @Excel(name = "任务描述", cellType = Excel.ColumnType.STRING)
  39 + private String mark;
  40 +
  41 + /** 系统盘点数 */
  42 + @Excel(name = "系统盘点数", cellType = Excel.ColumnType.NUMERIC)
  43 + private String sysCount;
  44 +
  45 + /** 人工盘点数 */
  46 + @Excel(name = "人工盘点数", cellType = Excel.ColumnType.NUMERIC)
  47 + private String count;
  48 +
  49 + /** 差异描述 */
  50 + @Excel(name = "差异描述", cellType = Excel.ColumnType.STRING)
  51 + private String remark;
  52 +
  53 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  54 + private Date createTime;
  55 +
  56 + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
  57 + private Date updateTime;
  58 +
  59 + private String selectType1;
  60 +
  61 + private String selectType2;
  62 +
  63 + private String selectType3;
  64 +
  65 + public Long getId() {
  66 + return id;
  67 + }
  68 +
  69 + public void setId(Long id) {
  70 + this.id = id;
  71 + }
  72 +
  73 + public Long getDepotId() {
  74 + return depotId;
  75 + }
  76 +
  77 + public void setDepotId(Long depotId) {
  78 + this.depotId = depotId;
  79 + }
  80 +
  81 + public String getDepotName() {
  82 + return depotName;
  83 + }
  84 +
  85 + public void setDepotName(String depotName) {
  86 + this.depotName = depotName;
  87 + }
  88 +
  89 + public int getArchivesLevel() {
  90 + return archivesLevel;
  91 + }
  92 +
  93 + public void setArchivesLevel(int archivesLevel) {
  94 + this.archivesLevel = archivesLevel;
  95 + }
  96 +
  97 + public String getFactor() {
  98 + return factor;
  99 + }
  100 +
  101 + public void setFactor(String factor) {
  102 + if (factor!=null&&factor.split("&").length==3){
  103 + this.selectType1=factor.split("&")[0];
  104 + this.selectType2=factor.split("&")[1];
  105 + this.selectType3=factor.split("&")[2];
  106 + }
  107 + this.factor = factor;
  108 + }
  109 +
  110 + public String getMark() {
  111 + return mark;
  112 + }
  113 +
  114 + public void setMark(String mark) {
  115 + this.mark = mark;
  116 + }
  117 +
  118 + public String getSysCount() {
  119 + return sysCount;
  120 + }
  121 +
  122 + public void setSysCount(String sysCount) {
  123 + this.sysCount = sysCount;
  124 + }
  125 +
  126 + public String getCount() {
  127 + return count;
  128 + }
  129 +
  130 + public void setCount(String count) {
  131 + this.count = count;
  132 + }
  133 +
  134 + @Override
  135 + public String getRemark() {
  136 + return remark;
  137 + }
  138 +
  139 + @Override
  140 + public void setRemark(String remark) {
  141 + this.remark = remark;
  142 + }
  143 +
  144 + @Override
  145 + public Date getCreateTime() {
  146 + return createTime;
  147 + }
  148 +
  149 + @Override
  150 + public void setCreateTime(Date createTime) {
  151 + this.createTime = createTime;
  152 + }
  153 +
  154 + @Override
  155 + public Date getUpdateTime() {
  156 + return updateTime;
  157 + }
  158 +
  159 + @Override
  160 + public void setUpdateTime(Date updateTime) {
  161 + this.updateTime = updateTime;
  162 + }
  163 +
  164 + public String getSelectType1() {
  165 + return selectType1;
  166 + }
  167 +
  168 + public void setSelectType1(String selectType1) {
  169 + this.selectType1 = selectType1;
  170 + }
  171 +
  172 + public String getSelectType2() {
  173 + return selectType2;
  174 + }
  175 +
  176 + public void setSelectType2(String selectType2) {
  177 + this.selectType2 = selectType2;
  178 + }
  179 +
  180 + public String getSelectType3() {
  181 + return selectType3;
  182 + }
  183 +
  184 + public void setSelectType3(String selectType3) {
  185 + this.selectType3 = selectType3;
  186 + }
  187 +}
ruoyi-service/src/main/java/com/ruoyi/service/mapper/InventoryMapper.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 ym
  11 + */
  12 +public interface InventoryMapper
  13 +{
  14 + int insert(Inventory inventory);
  15 + int update(Inventory inventory);
  16 + int delete(Long id);
  17 + List<Inventory> selectList(Inventory inventory);
  18 +}
ruoyi-service/src/main/java/com/ruoyi/service/service/InventoryService.java 0 → 100644
  1 +package com.ruoyi.service.service;
  2 +
  3 +
  4 +import com.ruoyi.service.domain.*;
  5 +
  6 +import java.util.List;
  7 +
  8 +/**
  9 + * 库房盘点 服务层
  10 + *
  11 + * @author ym
  12 + */
  13 +public interface InventoryService
  14 +{
  15 + int insert(Inventory inventory);
  16 + int update(Inventory inventory);
  17 + int delete(Long id);
  18 + List<Inventory> selectList(Inventory inventory);
  19 +}
ruoyi-service/src/main/java/com/ruoyi/service/service/impl/InventoryServiceImpl.java 0 → 100644
  1 +package com.ruoyi.service.service.impl;
  2 +
  3 +import com.alibaba.fastjson2.JSONObject;
  4 +import com.ruoyi.common.core.domain.AjaxResult;
  5 +import com.ruoyi.common.utils.StringUtils;
  6 +import com.ruoyi.service.domain.*;
  7 +import com.ruoyi.service.mapper.DepotMapper;
  8 +import com.ruoyi.service.mapper.InventoryMapper;
  9 +import com.ruoyi.service.service.DepotService;
  10 +import com.ruoyi.service.service.InventoryService;
  11 +import org.springframework.stereotype.Service;
  12 +
  13 +import javax.annotation.Resource;
  14 +import java.util.*;
  15 +
  16 +
  17 +/**
  18 + * 库房盘点 服务实现
  19 + *
  20 + * @author ym
  21 + */
  22 +@Service
  23 +public class InventoryServiceImpl implements InventoryService
  24 +{
  25 + @Resource
  26 + private InventoryMapper inventoryMapper;
  27 +
  28 +
  29 + @Override
  30 + public int insert(Inventory inventory) {
  31 + return inventoryMapper.insert(inventory);
  32 + }
  33 +
  34 + @Override
  35 + public int update(Inventory inventory) {
  36 + return inventoryMapper.update(inventory);
  37 + }
  38 +
  39 + @Override
  40 + public int delete(Long id) {
  41 + return inventoryMapper.delete(id);
  42 + }
  43 +
  44 + @Override
  45 + public List<Inventory> selectList(Inventory inventory) {
  46 + return inventoryMapper.selectList(inventory);
  47 + }
  48 +}
ruoyi-service/src/main/resources/mapper/sevice/InventoryMapper.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.InventoryMapper">
  6 +
  7 + <insert id="insert" parameterType="com.ruoyi.service.domain.Inventory">
  8 + insert into inventory(
  9 + <if test="depotId != null and depotId != ''">depotId,</if>
  10 + <if test="archivesLevel != null and archivesLevel != ''">archivesLevel,</if>
  11 + <if test="factor != null and factor != ''">factor,</if>
  12 + <if test="mark != null and mark != ''">mark,</if>
  13 + <if test="sysCount != null and sysCount != ''">sysCount,</if>
  14 + <if test="count != null and count != ''">count,</if>
  15 + <if test="remark != null and remark != ''">remark,</if>
  16 + createTime
  17 + )values(
  18 + <if test="depotId != null and depotId != ''">#{depotId},</if>
  19 + <if test="archivesLevel != null and archivesLevel != ''">#{archivesLevel},</if>
  20 + <if test="factor != null and factor != ''">#{factor},</if>
  21 + <if test="mark != null and mark != ''">#{mark},</if>
  22 + <if test="sysCount != null and sysCount != ''">#{sysCount},</if>
  23 + <if test="count != null and count != ''">#{count},</if>
  24 + <if test="remark != null and remark != ''">#{remark},</if>
  25 + sysdate()
  26 + )
  27 + </insert>
  28 +
  29 + <update id="update" parameterType="com.ruoyi.service.domain.Inventory">
  30 + update inventory
  31 + <set>
  32 + <if test="archivesLevel != null and archivesLevel != ''">archivesLevel = #{archivesLevel},</if>
  33 + <if test="factor != null and factor != ''">factor = #{factor},</if>
  34 + <if test="mark != null">mark = #{mark},</if>
  35 + <if test="sysCount != null and sysCount != ''">sysCount = #{sysCount},</if>
  36 + <if test="count != null and count != ''">count = #{count},</if>
  37 + <if test="remark != null and remark != ''">remark = #{remark},</if>
  38 + updateTime = sysdate()
  39 + </set>
  40 + where id = #{id}
  41 + </update>
  42 +
  43 + <delete id="delete" parameterType="Long">
  44 + delete from inventory where id = #{id}
  45 + </delete>
  46 +
  47 + <select id="selectList" resultType="com.ruoyi.service.domain.Inventory" parameterType="com.ruoyi.service.domain.Inventory">
  48 + select a.*,b.depotName from inventory a,depot b
  49 + where a.depotId=b.id
  50 + <if test="archivesLevel != null and archivesLevel != ''">
  51 + AND a.archivesLevel =#{archivesLevel}
  52 + </if>
  53 + <if test="factor != null and factor != ''">
  54 + AND b.factor =#{factor}
  55 + </if>
  56 + <if test="mark != null and mark != ''">
  57 + AND b.mark =#{mark}
  58 + </if>
  59 + <if test="sysCount != null and sysCount != ''">
  60 + AND b.sysCount =#{sysCount}
  61 + </if>
  62 + <if test="count != null and count != ''">
  63 + AND b.count =#{count}
  64 + </if>
  65 + <if test="remark != null and remark != ''">
  66 + AND b.remark =#{remark}
  67 + </if>
  68 + </select>
  69 +
  70 +</mapper>
0 \ No newline at end of file 71 \ No newline at end of file
ruoyi-ui/src/api/service/depot.js
@@ -90,72 +90,11 @@ export function delNode(id) { @@ -90,72 +90,11 @@ export function delNode(id) {
90 }) 90 })
91 } 91 }
92 92
93 -export function getDepot(id) { 93 +export function getDepots() {
94 return request({ 94 return request({
95 - url: '/service/depot/' + parseStrEmpty(id), 95 + url: '/service/depot/getDepots',
96 method: 'get' 96 method: 'get'
97 }) 97 })
98 } 98 }
99 99
100 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/api/service/inventory.js 0 → 100644
  1 +import request from '@/utils/request'
  2 +
  3 +
  4 +export function listPost(query) {
  5 + return request({
  6 + url: '/service/inventory/list',
  7 + method: 'get',
  8 + params: query
  9 + })
  10 +}
  11 +
  12 +export function addPost(data) {
  13 + return request({
  14 + url: '/service/inventory',
  15 + method: 'post',
  16 + data: data
  17 + })
  18 +}
  19 +
  20 +export function updatePost(data) {
  21 + return request({
  22 + url: '/service/inventory',
  23 + method: 'put',
  24 + data: data
  25 + })
  26 +}
  27 +
  28 +export function delPost(id) {
  29 + return request({
  30 + url: '/service/inventory/' + id,
  31 + method: 'delete'
  32 + })
  33 +}
ruoyi-ui/src/views/service/depot/index.vue
1 <template> 1 <template>
2 <div class="app-container"> 2 <div class="app-container">
3 <el-row :gutter="20"> 3 <el-row :gutter="20">
4 - <!--部门数据--> 4 + <!--库房维护-->
5 <el-col :span="4" :xs="24"> 5 <el-col :span="4" :xs="24">
6 <div class="head-container"> 6 <div class="head-container">
7 <el-tree 7 <el-tree
ruoyi-ui/src/views/service/inventory/index.vue 0 → 100644
  1 +<template>
  2 + <div class="app-container">
  3 + <el-row :gutter="10" class="mb8">
  4 + <el-col :span="1.5">
  5 + <el-button
  6 + type="primary"
  7 + plain
  8 + icon="el-icon-plus"
  9 + size="mini"
  10 + @click="handleAdd"
  11 + v-hasPermi="['service:inventory:add']"
  12 + >新增</el-button>
  13 + </el-col>
  14 + <el-col :span="1.5">
  15 + <el-button
  16 + type="success"
  17 + plain
  18 + icon="el-icon-edit"
  19 + size="mini"
  20 + :disabled="single"
  21 + @click="handleUpdate"
  22 + v-hasPermi="['system:post:edit']"
  23 + >编辑</el-button>
  24 + </el-col>
  25 + <el-col :span="1.5">
  26 + <el-button
  27 + type="danger"
  28 + plain
  29 + icon="el-icon-delete"
  30 + size="mini"
  31 + :disabled="multiple"
  32 + @click="handleDelete"
  33 + v-hasPermi="['system:post:remove']"
  34 + >删除</el-button>
  35 + </el-col>
  36 + <el-col :span="1.5">
  37 + <el-button
  38 + type="warning"
  39 + plain
  40 + icon="el-icon-download"
  41 + size="mini"
  42 + @click="handleExport"
  43 + v-hasPermi="['system:post:export']"
  44 + >盘点</el-button>
  45 + </el-col>
  46 + <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
  47 + </el-row>
  48 +
  49 + <el-table v-loading="loading" :data="postList" @selection-change="handleSelectionChange">
  50 + <el-table-column type="selection" width="55" align="center" />
  51 + <el-table-column label="档案库" align="center" prop="depotName" />
  52 + <el-table-column label="级别" align="center" prop="archivesLevel" :formatter="archivesLevelFormat"/>
  53 + <el-table-column label="条件" align="center" prop="factor" />
  54 + <el-table-column label="任务描述" align="center" prop="mark" />
  55 + <el-table-column label="系统盘点数" align="center" prop="sysCount" />
  56 + <el-table-column label="人工盘点数" align="center" prop="count" />
  57 + <el-table-column label="差异描述" align="center" prop="remark" />
  58 + <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
  59 + <template slot-scope="scope">
  60 + <el-button
  61 + size="mini"
  62 + type="text"
  63 + icon="el-icon-edit"
  64 + @click="handleUpdate(scope.row)"
  65 + v-hasPermi="['system:post:edit']"
  66 + >盘点</el-button>
  67 + <el-button
  68 + size="mini"
  69 + type="text"
  70 + icon="el-icon-edit"
  71 + @click="handleUpdate(scope.row)"
  72 + v-hasPermi="['system:post:edit']"
  73 + >编辑</el-button>
  74 + <el-button
  75 + size="mini"
  76 + type="text"
  77 + icon="el-icon-delete"
  78 + @click="handleDelete(scope.row)"
  79 + v-hasPermi="['system:post:remove']"
  80 + >删除</el-button>
  81 + </template>
  82 + </el-table-column>
  83 + </el-table>
  84 +
  85 + <pagination
  86 + v-show="total>0"
  87 + :total="total"
  88 + :page.sync="queryParams.pageNum"
  89 + :limit.sync="queryParams.pageSize"
  90 + @pagination="getList"
  91 + />
  92 +
  93 + <!-- 添加或修改对话框 -->
  94 + <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
  95 + <el-form ref="form" :model="form" :rules="rules" label-width="90px">
  96 + <el-form-item label="任务描述" >
  97 + <el-input v-model="form.mark" placeholder="请输入任务描述" :disabled="edit"/>
  98 + </el-form-item>
  99 + <el-form-item label="档案库" >
  100 + <el-select v-model="form.depotId" placeholder="档案库" :disabled="edit">
  101 + <el-option
  102 + v-for="depot in depotOptions"
  103 + :key="depot.id"
  104 + :label="depot.depotName"
  105 + :value="depot.id"
  106 + />
  107 + </el-select>
  108 + </el-form-item>
  109 + <el-form-item label="档案级别" >
  110 + <el-select v-model="form.archivesLevel" placeholder="档案级别" :disabled="edit">
  111 + <el-option
  112 + v-for="dict in dict.type.archivesLevel"
  113 + :key="dict.value"
  114 + :label="dict.label"
  115 + :value="dict.value"
  116 + />
  117 + </el-select>
  118 + </el-form-item>
  119 + <el-form-item label="选择条件" >
  120 + <el-select v-model="form.selectType1" placeholder="请选择" :disabled="edit">
  121 + <el-option
  122 + v-for="dict in dict.type.selectType1"
  123 + :key="dict.value"
  124 + :label="dict.label"
  125 + :value="dict.label"
  126 + />
  127 + </el-select>
  128 + <el-select v-model="form.selectType2" placeholder="范围" :disabled="edit">
  129 + <el-option
  130 + v-for="dict in dict.type.selectType2"
  131 + :key="dict.value"
  132 + :label="dict.label"
  133 + :value="dict.label"
  134 + />
  135 + </el-select>
  136 + <el-date-picker
  137 + v-model="form.selectType3" type="date" placeholder="选择日期" value-format="yyyy-MM-dd HH:mm:ss" v-if="form.selectType1=='创建日期'" :disabled="edit">
  138 + </el-date-picker>
  139 + </el-form-item>
  140 + <el-form-item label="人工盘点数" v-if="this.edit==true">
  141 + <el-input-number v-model="form.count" controls-position="right" :min="0" />
  142 + </el-form-item>
  143 + <el-form-item label="差异描述" v-if="this.edit==true">
  144 + <el-input v-model="form.remark" />
  145 + </el-form-item>
  146 + </el-form>
  147 + <div slot="footer" class="dialog-footer">
  148 + <el-button type="primary" @click="submitForm">确 定</el-button>
  149 + <el-button @click="cancel">取 消</el-button>
  150 + </div>
  151 + </el-dialog>
  152 + </div>
  153 +</template>
  154 +
  155 +<script>
  156 +import { listPost, getPost, delPost, addPost, updatePost } from "@/api/service/inventory";
  157 +import {getDepots} from "@/api/service/depot";
  158 +export default {
  159 + name: "Post",
  160 + dicts: ['archivesLevel','selectType1','selectType2'],
  161 + data() {
  162 + return {
  163 + // 遮罩层
  164 + loading: true,
  165 + // 选中数组
  166 + ids: [],
  167 + // 非单个禁用
  168 + single: true,
  169 + // 非多个禁用
  170 + multiple: true,
  171 + // 显示搜索条件
  172 + showSearch: true,
  173 + // 总条数
  174 + total: 0,
  175 + // 岗位表格数据
  176 + postList: [],
  177 + // 弹出层标题
  178 + title: "",
  179 + // 是否显示弹出层
  180 + open: false,
  181 + // 查询参数
  182 + queryParams: {
  183 + pageNum: 1,
  184 + pageSize: 10
  185 + },
  186 + // 表单参数
  187 + form: {},
  188 + // 表单校验
  189 + rules: {
  190 + },
  191 + depotOptions:[],
  192 + edit:false,
  193 + };
  194 + },
  195 + created() {
  196 + this.getList();
  197 + },
  198 + methods: {
  199 + getList() {
  200 + this.loading = true;
  201 + listPost(this.queryParams).then(response => {
  202 + this.postList = response.rows;
  203 + this.total = response.total;
  204 + this.loading = false;
  205 + });
  206 + },
  207 + // 取消按钮
  208 + cancel() {
  209 + this.open = false;
  210 + this.reset();
  211 + },
  212 + // 表单重置
  213 + reset() {
  214 + this.form = {
  215 + archivesLevel: undefined,
  216 + selectType1:undefined,
  217 + selectType2:undefined,
  218 + selectType3:undefined,
  219 + factor: undefined,
  220 + mark: undefined,
  221 + sysCount: 0,
  222 + count: "0",
  223 + remark: undefined,
  224 + depotId: undefined
  225 + };
  226 + this.resetForm("form");
  227 + },
  228 + /** 搜索按钮操作 */
  229 + handleQuery() {
  230 + this.queryParams.pageNum = 1;
  231 + this.getList();
  232 + },
  233 + /** 重置按钮操作 */
  234 + resetQuery() {
  235 + this.resetForm("queryForm");
  236 + this.handleQuery();
  237 + },
  238 + // 多选框选中数据
  239 + handleSelectionChange(selection) {
  240 + this.ids = selection.map(item => item.postId)
  241 + this.single = selection.length!=1
  242 + this.multiple = !selection.length
  243 + },
  244 + /** 新增按钮操作 */
  245 + handleAdd() {
  246 + this.edit=false;
  247 + this.reset();
  248 + getDepots().then(response => {
  249 + this.depotOptions = response.depotOptions;
  250 + this.open = true;
  251 + this.title = "添加";
  252 + });
  253 + },
  254 + /** 修改按钮操作 */
  255 + handleUpdate(row) {
  256 + this.edit=true;
  257 + this.reset();
  258 + this.form = row;
  259 + this.open = true;
  260 + this.title = "修改岗位";
  261 + },
  262 + /** 提交按钮 */
  263 + submitForm: function() {
  264 + this.$refs["form"].validate(valid => {
  265 + if (valid) {
  266 + if (this.edit) {
  267 + updatePost(this.form).then(response => {
  268 + this.$modal.msgSuccess("修改成功");
  269 + this.open = false;
  270 + this.getList();
  271 + });
  272 + } else {
  273 + addPost(this.form).then(response => {
  274 + this.$modal.msgSuccess("新增成功");
  275 + this.open = false;
  276 + this.getList();
  277 + });
  278 + }
  279 + }
  280 + });
  281 + },
  282 + /** 删除按钮操作 */
  283 + handleDelete(row) {
  284 + this.$modal.confirm('是否确认删除数据?').then(function() {
  285 + return delPost(row.id);
  286 + }).then(() => {
  287 + this.getList();
  288 + this.$modal.msgSuccess("删除成功");
  289 + }).catch(() => {});
  290 + },
  291 + archivesLevelFormat(row, column) {
  292 + return this.selectDictLabel(this.dict.type.archivesLevel, row.archivesLevel);
  293 + }
  294 + }
  295 +};
  296 +</script>