部门 巷道 重量统计

This commit is contained in:
刘汗青
2026-06-08 10:09:26 +08:00
parent 2ffea4b088
commit aab14ac716
12 changed files with 879 additions and 0 deletions

View File

@@ -0,0 +1,104 @@
package com.ruoyi.search.weight.controller;
import java.util.List;
import jakarta.servlet.http.HttpServletResponse;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.search.weight.domain.ViewCargoSpaceWeight;
import com.ruoyi.search.weight.service.IViewCargoSpaceWeightService;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* 各巷道重量统计Controller
*
* @author ruoyi
* @date 2026-06-08
*/
@RestController
@RequestMapping("/search/weight")
public class ViewCargoSpaceWeightController extends BaseController
{
@Autowired
private IViewCargoSpaceWeightService viewCargoSpaceWeightService;
/**
* 查询各巷道重量统计列表
*/
@PreAuthorize("@ss.hasPermi('search:weight:list')")
@GetMapping("/list")
public TableDataInfo list(ViewCargoSpaceWeight viewCargoSpaceWeight)
{
startPage();
List<ViewCargoSpaceWeight> list = viewCargoSpaceWeightService.selectViewCargoSpaceWeightList(viewCargoSpaceWeight);
return getDataTable(list);
}
/**
* 导出各巷道重量统计列表
*/
@PreAuthorize("@ss.hasPermi('search:weight:export')")
@Log(title = "各巷道重量统计", businessType = BusinessType.EXPORT)
@PostMapping("/export")
public void export(HttpServletResponse response, ViewCargoSpaceWeight viewCargoSpaceWeight)
{
List<ViewCargoSpaceWeight> list = viewCargoSpaceWeightService.selectViewCargoSpaceWeightList(viewCargoSpaceWeight);
ExcelUtil<ViewCargoSpaceWeight> util = new ExcelUtil<ViewCargoSpaceWeight>(ViewCargoSpaceWeight.class);
util.exportExcel(response, list, "各巷道重量统计数据");
}
/**
* 获取各巷道重量统计详细信息
*/
@PreAuthorize("@ss.hasPermi('search:weight:query')")
@GetMapping(value = "/{warehouseId}")
public AjaxResult getInfo(@PathVariable("warehouseId") String warehouseId)
{
return success(viewCargoSpaceWeightService.selectViewCargoSpaceWeightByWarehouseId(warehouseId));
}
/**
* 新增各巷道重量统计
*/
@PreAuthorize("@ss.hasPermi('search:weight:add')")
@Log(title = "各巷道重量统计", businessType = BusinessType.INSERT)
@PostMapping
public AjaxResult add(@RequestBody ViewCargoSpaceWeight viewCargoSpaceWeight)
{
return toAjax(viewCargoSpaceWeightService.insertViewCargoSpaceWeight(viewCargoSpaceWeight));
}
/**
* 修改各巷道重量统计
*/
@PreAuthorize("@ss.hasPermi('search:weight:edit')")
@Log(title = "各巷道重量统计", businessType = BusinessType.UPDATE)
@PutMapping
public AjaxResult edit(@RequestBody ViewCargoSpaceWeight viewCargoSpaceWeight)
{
return toAjax(viewCargoSpaceWeightService.updateViewCargoSpaceWeight(viewCargoSpaceWeight));
}
/**
* 删除各巷道重量统计
*/
@PreAuthorize("@ss.hasPermi('search:weight:remove')")
@Log(title = "各巷道重量统计", businessType = BusinessType.DELETE)
@DeleteMapping("/{warehouseIds}")
public AjaxResult remove(@PathVariable String[] warehouseIds)
{
return toAjax(viewCargoSpaceWeightService.deleteViewCargoSpaceWeightByWarehouseIds(warehouseIds));
}
}

View File

@@ -0,0 +1,99 @@
package com.ruoyi.search.weight.domain;
import java.math.BigDecimal;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.ruoyi.common.annotation.Excel;
import com.ruoyi.common.core.domain.BaseEntity;
/**
* 各巷道重量统计对象 view_cargo_space_weight
*
* @author ruoyi
* @date 2026-06-08
*/
public class ViewCargoSpaceWeight extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 仓库id */
@Excel(name = "仓库id")
private String warehouseId;
/** 仓库名称 */
@Excel(name = "仓库名称")
private String warehouseName;
/** 巷道 */
@Excel(name = "巷道")
private String roadwayId;
/** 排 */
@Excel(name = "排")
private BigDecimal thePlatoon;
/** 总量 */
@Excel(name = "总量")
private BigDecimal weightTotal;
public void setWarehouseId(String warehouseId)
{
this.warehouseId = warehouseId;
}
public String getWarehouseId()
{
return warehouseId;
}
public void setWarehouseName(String warehouseName)
{
this.warehouseName = warehouseName;
}
public String getWarehouseName()
{
return warehouseName;
}
public void setRoadwayId(String roadwayId)
{
this.roadwayId = roadwayId;
}
public String getRoadwayId()
{
return roadwayId;
}
public void setThePlatoon(BigDecimal thePlatoon)
{
this.thePlatoon = thePlatoon;
}
public BigDecimal getThePlatoon()
{
return thePlatoon;
}
public void setWeightTotal(BigDecimal weightTotal)
{
this.weightTotal = weightTotal;
}
public BigDecimal getWeightTotal()
{
return weightTotal;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("warehouseId", getWarehouseId())
.append("warehouseName", getWarehouseName())
.append("roadwayId", getRoadwayId())
.append("thePlatoon", getThePlatoon())
.append("weightTotal", getWeightTotal())
.toString();
}
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.search.weight.mapper;
import java.util.List;
import com.ruoyi.search.weight.domain.ViewCargoSpaceWeight;
/**
* 各巷道重量统计Mapper接口
*
* @author ruoyi
* @date 2026-06-08
*/
public interface ViewCargoSpaceWeightMapper
{
/**
* 查询各巷道重量统计
*
* @param warehouseId 各巷道重量统计主键
* @return 各巷道重量统计
*/
public ViewCargoSpaceWeight selectViewCargoSpaceWeightByWarehouseId(String warehouseId);
/**
* 查询各巷道重量统计列表
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 各巷道重量统计集合
*/
public List<ViewCargoSpaceWeight> selectViewCargoSpaceWeightList(ViewCargoSpaceWeight viewCargoSpaceWeight);
/**
* 新增各巷道重量统计
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 结果
*/
public int insertViewCargoSpaceWeight(ViewCargoSpaceWeight viewCargoSpaceWeight);
/**
* 修改各巷道重量统计
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 结果
*/
public int updateViewCargoSpaceWeight(ViewCargoSpaceWeight viewCargoSpaceWeight);
/**
* 删除各巷道重量统计
*
* @param warehouseId 各巷道重量统计主键
* @return 结果
*/
public int deleteViewCargoSpaceWeightByWarehouseId(String warehouseId);
/**
* 批量删除各巷道重量统计
*
* @param warehouseIds 需要删除的数据主键集合
* @return 结果
*/
public int deleteViewCargoSpaceWeightByWarehouseIds(String[] warehouseIds);
}

View File

@@ -0,0 +1,61 @@
package com.ruoyi.search.weight.service;
import java.util.List;
import com.ruoyi.search.weight.domain.ViewCargoSpaceWeight;
/**
* 各巷道重量统计Service接口
*
* @author ruoyi
* @date 2026-06-08
*/
public interface IViewCargoSpaceWeightService
{
/**
* 查询各巷道重量统计
*
* @param warehouseId 各巷道重量统计主键
* @return 各巷道重量统计
*/
public ViewCargoSpaceWeight selectViewCargoSpaceWeightByWarehouseId(String warehouseId);
/**
* 查询各巷道重量统计列表
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 各巷道重量统计集合
*/
public List<ViewCargoSpaceWeight> selectViewCargoSpaceWeightList(ViewCargoSpaceWeight viewCargoSpaceWeight);
/**
* 新增各巷道重量统计
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 结果
*/
public int insertViewCargoSpaceWeight(ViewCargoSpaceWeight viewCargoSpaceWeight);
/**
* 修改各巷道重量统计
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 结果
*/
public int updateViewCargoSpaceWeight(ViewCargoSpaceWeight viewCargoSpaceWeight);
/**
* 批量删除各巷道重量统计
*
* @param warehouseIds 需要删除的各巷道重量统计主键集合
* @return 结果
*/
public int deleteViewCargoSpaceWeightByWarehouseIds(String[] warehouseIds);
/**
* 删除各巷道重量统计信息
*
* @param warehouseId 各巷道重量统计主键
* @return 结果
*/
public int deleteViewCargoSpaceWeightByWarehouseId(String warehouseId);
}

View File

@@ -0,0 +1,118 @@
package com.ruoyi.search.weight.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import cn.hutool.core.collection.CollUtil;
import com.ruoyi.common.core.domain.entity.SysRole;
import com.ruoyi.common.utils.SecurityUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.search.weight.mapper.ViewCargoSpaceWeightMapper;
import com.ruoyi.search.weight.domain.ViewCargoSpaceWeight;
import com.ruoyi.search.weight.service.IViewCargoSpaceWeightService;
/**
* 各巷道重量统计Service业务层处理
*
* @author ruoyi
* @date 2026-06-08
*/
@Service
public class ViewCargoSpaceWeightServiceImpl implements IViewCargoSpaceWeightService
{
@Autowired
private ViewCargoSpaceWeightMapper viewCargoSpaceWeightMapper;
/**
* 查询各巷道重量统计
*
* @param warehouseId 各巷道重量统计主键
* @return 各巷道重量统计
*/
@Override
public ViewCargoSpaceWeight selectViewCargoSpaceWeightByWarehouseId(String warehouseId)
{
return viewCargoSpaceWeightMapper.selectViewCargoSpaceWeightByWarehouseId(warehouseId);
}
/**
* 查询各巷道重量统计列表
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 各巷道重量统计
*/
@Override
public List<ViewCargoSpaceWeight> selectViewCargoSpaceWeightList(ViewCargoSpaceWeight viewCargoSpaceWeight)
{
if (!"admin".equals(SecurityUtils.getUsername())){
List<SysRole> roles = SecurityUtils.getLoginUser().getUser().getRoles();
if (CollUtil.isEmpty(roles)) {
//如果未设置角色 ,直接返回空列表
return new ArrayList<>();
}
Optional<SysRole> first = roles.stream().filter(x -> "role1".equals(x.getRoleKey()) || "role3".equals(x.getRoleKey())).findFirst();
if (first.isPresent()){
//二联合普通人员
viewCargoSpaceWeight.setWarehouseId("02");
}
Optional<SysRole> first1 = roles.stream().filter(x -> "role2".equals(x.getRoleKey()) || "role4".equals(x.getRoleKey())).findFirst();
if (first1.isPresent()){
//三联合普通人员
viewCargoSpaceWeight.setWarehouseId("01");
}
}
return viewCargoSpaceWeightMapper.selectViewCargoSpaceWeightList(viewCargoSpaceWeight);
}
/**
* 新增各巷道重量统计
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 结果
*/
@Override
public int insertViewCargoSpaceWeight(ViewCargoSpaceWeight viewCargoSpaceWeight)
{
return viewCargoSpaceWeightMapper.insertViewCargoSpaceWeight(viewCargoSpaceWeight);
}
/**
* 修改各巷道重量统计
*
* @param viewCargoSpaceWeight 各巷道重量统计
* @return 结果
*/
@Override
public int updateViewCargoSpaceWeight(ViewCargoSpaceWeight viewCargoSpaceWeight)
{
return viewCargoSpaceWeightMapper.updateViewCargoSpaceWeight(viewCargoSpaceWeight);
}
/**
* 批量删除各巷道重量统计
*
* @param warehouseIds 需要删除的各巷道重量统计主键
* @return 结果
*/
@Override
public int deleteViewCargoSpaceWeightByWarehouseIds(String[] warehouseIds)
{
return viewCargoSpaceWeightMapper.deleteViewCargoSpaceWeightByWarehouseIds(warehouseIds);
}
/**
* 删除各巷道重量统计信息
*
* @param warehouseId 各巷道重量统计主键
* @return 结果
*/
@Override
public int deleteViewCargoSpaceWeightByWarehouseId(String warehouseId)
{
return viewCargoSpaceWeightMapper.deleteViewCargoSpaceWeightByWarehouseId(warehouseId);
}
}

View File

@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ruoyi.search.weight.mapper.ViewCargoSpaceWeightMapper">
<resultMap type="ViewCargoSpaceWeight" id="ViewCargoSpaceWeightResult">
<result property="warehouseId" column="warehouse_id" />
<result property="warehouseName" column="warehouse_name" />
<result property="roadwayId" column="roadway_id" />
<result property="thePlatoon" column="the_platoon" />
<result property="weightTotal" column="weight_total" />
</resultMap>
<sql id="selectViewCargoSpaceWeightVo">
select warehouse_id, warehouse_name, roadway_id, the_platoon, weight_total from view_cargo_space_weight
</sql>
<select id="selectViewCargoSpaceWeightList" parameterType="ViewCargoSpaceWeight" resultMap="ViewCargoSpaceWeightResult">
<include refid="selectViewCargoSpaceWeightVo"/>
<where>
<if test="warehouseId != null and warehouseId != ''"> and warehouse_id = #{warehouseId}</if>
<if test="warehouseName != null and warehouseName != ''"> and warehouse_name like concat('%', #{warehouseName}, '%')</if>
<if test="roadwayId != null and roadwayId != ''"> and roadway_id = #{roadwayId}</if>
<if test="thePlatoon != null "> and the_platoon = #{thePlatoon}</if>
<if test="weightTotal != null "> and weight_total = #{weightTotal}</if>
</where>
order by warehouse_id, roadway_id, the_platoon
</select>
<select id="selectViewCargoSpaceWeightByWarehouseId" parameterType="String" resultMap="ViewCargoSpaceWeightResult">
<include refid="selectViewCargoSpaceWeightVo"/>
where warehouse_id = #{warehouseId}
</select>
<insert id="insertViewCargoSpaceWeight" parameterType="ViewCargoSpaceWeight">
insert into view_cargo_space_weight
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="warehouseId != null and warehouseId != ''">warehouse_id,</if>
<if test="warehouseName != null">warehouse_name,</if>
<if test="roadwayId != null">roadway_id,</if>
<if test="thePlatoon != null">the_platoon,</if>
<if test="weightTotal != null">weight_total,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="warehouseId != null and warehouseId != ''">#{warehouseId},</if>
<if test="warehouseName != null">#{warehouseName},</if>
<if test="roadwayId != null">#{roadwayId},</if>
<if test="thePlatoon != null">#{thePlatoon},</if>
<if test="weightTotal != null">#{weightTotal},</if>
</trim>
</insert>
<update id="updateViewCargoSpaceWeight" parameterType="ViewCargoSpaceWeight">
update view_cargo_space_weight
<trim prefix="SET" suffixOverrides=",">
<if test="warehouseName != null">warehouse_name = #{warehouseName},</if>
<if test="roadwayId != null">roadway_id = #{roadwayId},</if>
<if test="thePlatoon != null">the_platoon = #{thePlatoon},</if>
<if test="weightTotal != null">weight_total = #{weightTotal},</if>
</trim>
where warehouse_id = #{warehouseId}
</update>
<delete id="deleteViewCargoSpaceWeightByWarehouseId" parameterType="String">
delete from view_cargo_space_weight where warehouse_id = #{warehouseId}
</delete>
<delete id="deleteViewCargoSpaceWeightByWarehouseIds" parameterType="String">
delete from view_cargo_space_weight where warehouse_id in
<foreach item="warehouseId" collection="array" open="(" separator="," close=")">
#{warehouseId}
</foreach>
</delete>
</mapper>

View File

@@ -103,6 +103,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="dateEnd != null and dateEnd != ''"> and finish_time &lt;= #{dateEnd}</if> <if test="dateEnd != null and dateEnd != ''"> and finish_time &lt;= #{dateEnd}</if>
<if test="cargoSpaceId != null and cargoSpaceId != ''"> and cargo_space_id = #{cargoSpaceId}</if> <if test="cargoSpaceId != null and cargoSpaceId != ''"> and cargo_space_id = #{cargoSpaceId}</if>
<if test="roadwayId != null and roadwayId != ''"> and roadway_id = #{roadwayId}</if> <if test="roadwayId != null and roadwayId != ''"> and roadway_id = #{roadwayId}</if>
<if test="deptName != null and deptName != ''"> and dept_name = #{deptName}</if>
<if test="params.warehouseDataScope != null and params.warehouseDataScope !=''"> <if test="params.warehouseDataScope != null and params.warehouseDataScope !=''">
${params.warehouseDataScope} ${params.warehouseDataScope}
</if> </if>

View File

@@ -109,6 +109,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<if test="productName != null and productName != ''"> and bs.product_name like concat('%',#{productName},'%')</if> <if test="productName != null and productName != ''"> and bs.product_name like concat('%',#{productName},'%')</if>
<if test="warehouseId != null and warehouseId != ''"> and bs.warehouse_id = #{warehouseId}</if> <if test="warehouseId != null and warehouseId != ''"> and bs.warehouse_id = #{warehouseId}</if>
<if test="trayCode != null and trayCode != ''"> and bs.tray_code = #{trayCode}</if> <if test="trayCode != null and trayCode != ''"> and bs.tray_code = #{trayCode}</if>
<if test="roadwayId != null and roadwayId != ''"> and bcs.roadway_id = #{roadwayId}</if>
<if test="inDateStart != null and inDateStart != '' and inDateEnd != null and inDateEnd != ''"> and bs.in_date between #{inDateStart} and #{inDateEnd}</if> <if test="inDateStart != null and inDateStart != '' and inDateEnd != null and inDateEnd != ''"> and bs.in_date between #{inDateStart} and #{inDateEnd}</if>
</where> </where>

View File

@@ -0,0 +1,44 @@
import request from '@/utils/request'
// 查询各巷道重量统计列表
export function listWeight(query) {
return request({
url: '/search/weight/list',
method: 'get',
params: query
})
}
// 查询各巷道重量统计详细
export function getWeight(warehouseId) {
return request({
url: '/search/weight/' + warehouseId,
method: 'get'
})
}
// 新增各巷道重量统计
export function addWeight(data) {
return request({
url: '/search/weight',
method: 'post',
data: data
})
}
// 修改各巷道重量统计
export function updateWeight(data) {
return request({
url: '/search/weight',
method: 'put',
data: data
})
}
// 删除各巷道重量统计
export function delWeight(warehouseId) {
return request({
url: '/search/weight/' + warehouseId,
method: 'delete'
})
}

View File

@@ -58,6 +58,14 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="部门" prop="deptName">
<el-input
v-model="queryParams.deptName"
placeholder="请输入部门"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="巷道" prop="roadwayId"> <el-form-item label="巷道" prop="roadwayId">
<el-input <el-input
v-model="queryParams.roadwayId" v-model="queryParams.roadwayId"
@@ -406,6 +414,7 @@ export default {
managementNo: null, managementNo: null,
dateStart:null, dateStart:null,
dateEnd:null, dateEnd:null,
deptName:null,
roadwayId:null roadwayId:null
}, },
// 表单参数 // 表单参数

View File

@@ -61,6 +61,14 @@
@keyup.enter.native="handleQuery" @keyup.enter.native="handleQuery"
/> />
</el-form-item> </el-form-item>
<el-form-item label="巷道" prop="roadwayId">
<el-input
v-model="queryParams.roadwayId"
placeholder="请输入巷道"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="起始时间" prop="inDateStart"> <el-form-item label="起始时间" prop="inDateStart">
<el-date-picker clearable <el-date-picker clearable
v-model="queryParams.inDateStart" v-model="queryParams.inDateStart"
@@ -249,6 +257,7 @@ export default {
trayCode:null, trayCode:null,
inDateStart:null, inDateStart:null,
inDateEnd:null, inDateEnd:null,
roadwayId:null
}, },
// 表单参数 // 表单参数
form: {}, form: {},

View File

@@ -0,0 +1,297 @@
<template>
<div class="app-container">
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="68px">
<el-form-item label="仓库id" prop="warehouseId">
<el-input
v-model="queryParams.warehouseId"
placeholder="请输入仓库id"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="仓库名称" prop="warehouseName">
<el-input
v-model="queryParams.warehouseName"
placeholder="请输入仓库名称"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="巷道" prop="roadwayId">
<el-input
v-model="queryParams.roadwayId"
placeholder="请输入巷道"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="排" prop="thePlatoon">
<el-input
v-model="queryParams.thePlatoon"
placeholder="请输入排"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item label="总量" prop="weightTotal">
<el-input
v-model="queryParams.weightTotal"
placeholder="请输入总量"
clearable
@keyup.enter.native="handleQuery"
/>
</el-form-item>
<el-form-item>
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
<el-button icon="el-icon-refresh" size="mini" @click="handleExport" v-hasPermi="['search:weight:export']">导出</el-button>
</el-form-item>
</el-form>
<!-- <el-row :gutter="10" class="mb8">-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="primary"-->
<!-- plain-->
<!-- icon="el-icon-plus"-->
<!-- size="mini"-->
<!-- @click="handleAdd"-->
<!-- v-hasPermi="['search:weight:add']"-->
<!-- >新增</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="success"-->
<!-- plain-->
<!-- icon="el-icon-edit"-->
<!-- size="mini"-->
<!-- :disabled="single"-->
<!-- @click="handleUpdate"-->
<!-- v-hasPermi="['search:weight:edit']"-->
<!-- >修改</el-button>-->
<!-- </el-col>-->
<!-- <el-col :span="1.5">-->
<!-- <el-button-->
<!-- type="danger"-->
<!-- plain-->
<!-- icon="el-icon-delete"-->
<!-- size="mini"-->
<!-- :disabled="multiple"-->
<!-- @click="handleDelete"-->
<!-- v-hasPermi="['search:weight:remove']"-->
<!-- >删除</el-button>-->
<!-- </el-col>-->
<!-- -->
<!-- <right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>-->
<!-- </el-row>-->
<el-table v-loading="loading" :data="weightList" @selection-change="handleSelectionChange">
<!-- <el-table-column type="selection" width="55" align="center" />-->
<el-table-column label="仓库id" align="center" prop="warehouseId" />
<el-table-column label="仓库名称" align="center" prop="warehouseName" />
<el-table-column label="巷道" align="center" prop="roadwayId" />
<el-table-column label="排" align="center" prop="thePlatoon" />
<el-table-column label="总量(KG)" align="center" prop="weightTotal" />
<!-- <el-table-column label="操作" align="center" class-name="small-padding fixed-width">-->
<!-- <template slot-scope="scope">-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-edit"-->
<!-- @click="handleUpdate(scope.row)"-->
<!-- v-hasPermi="['search:weight:edit']"-->
<!-- >修改</el-button>-->
<!-- <el-button-->
<!-- size="mini"-->
<!-- type="text"-->
<!-- icon="el-icon-delete"-->
<!-- @click="handleDelete(scope.row)"-->
<!-- v-hasPermi="['search:weight:remove']"-->
<!-- >删除</el-button>-->
<!-- </template>-->
<!-- </el-table-column>-->
</el-table>
<pagination
v-show="total>0"
:total="total"
:page.sync="queryParams.pageNum"
:limit.sync="queryParams.pageSize"
@pagination="getList"
/>
<!-- 添加或修改各巷道重量统计对话框 -->
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
<el-form ref="form" :model="form" :rules="rules" label-width="80px">
<el-form-item label="仓库id" prop="warehouseId">
<el-input v-model="form.warehouseId" placeholder="请输入仓库id" />
</el-form-item>
<el-form-item label="仓库名称" prop="warehouseName">
<el-input v-model="form.warehouseName" placeholder="请输入仓库名称" />
</el-form-item>
<el-form-item label="巷道" prop="roadwayId">
<el-input v-model="form.roadwayId" placeholder="请输入巷道" />
</el-form-item>
<el-form-item label="排" prop="thePlatoon">
<el-input v-model="form.thePlatoon" placeholder="请输入排" />
</el-form-item>
<el-form-item label="总量" prop="weightTotal">
<el-input v-model="form.weightTotal" placeholder="请输入总量" />
</el-form-item>
</el-form>
<div slot="footer" class="dialog-footer">
<el-button type="primary" @click="submitForm">确 定</el-button>
<el-button @click="cancel">取 消</el-button>
</div>
</el-dialog>
</div>
</template>
<script>
import { listWeight, getWeight, delWeight, addWeight, updateWeight } from "@/api/search/weight"
export default {
name: "Weight",
data() {
return {
// 遮罩层
loading: true,
// 选中数组
ids: [],
// 非单个禁用
single: true,
// 非多个禁用
multiple: true,
// 显示搜索条件
showSearch: true,
// 总条数
total: 0,
// 各巷道重量统计表格数据
weightList: [],
// 弹出层标题
title: "",
// 是否显示弹出层
open: false,
// 查询参数
queryParams: {
pageNum: 1,
pageSize: 10,
warehouseId: null,
warehouseName: null,
roadwayId: null,
thePlatoon: null,
weightTotal: null
},
// 表单参数
form: {},
// 表单校验
rules: {
warehouseId: [
{ required: true, message: "仓库id不能为空", trigger: "blur" }
],
thePlatoon: [
{ required: true, message: "排不能为空", trigger: "blur" }
],
}
}
},
created() {
this.getList()
},
methods: {
/** 查询各巷道重量统计列表 */
getList() {
this.loading = true
listWeight(this.queryParams).then(response => {
this.weightList = response.rows
this.total = response.total
this.loading = false
})
},
// 取消按钮
cancel() {
this.open = false
this.reset()
},
// 表单重置
reset() {
this.form = {
warehouseId: null,
warehouseName: null,
roadwayId: null,
thePlatoon: null,
weightTotal: null
}
this.resetForm("form")
},
/** 搜索按钮操作 */
handleQuery() {
this.queryParams.pageNum = 1
this.getList()
},
/** 重置按钮操作 */
resetQuery() {
this.resetForm("queryForm")
this.handleQuery()
},
// 多选框选中数据
handleSelectionChange(selection) {
this.ids = selection.map(item => item.warehouseId)
this.single = selection.length!==1
this.multiple = !selection.length
},
/** 新增按钮操作 */
handleAdd() {
this.reset()
this.open = true
this.title = "添加各巷道重量统计"
},
/** 修改按钮操作 */
handleUpdate(row) {
this.reset()
const warehouseId = row.warehouseId || this.ids
getWeight(warehouseId).then(response => {
this.form = response.data
this.open = true
this.title = "修改各巷道重量统计"
})
},
/** 提交按钮 */
submitForm() {
this.$refs["form"].validate(valid => {
if (valid) {
if (this.form.warehouseId != null) {
updateWeight(this.form).then(response => {
this.$modal.msgSuccess("修改成功")
this.open = false
this.getList()
})
} else {
addWeight(this.form).then(response => {
this.$modal.msgSuccess("新增成功")
this.open = false
this.getList()
})
}
}
})
},
/** 删除按钮操作 */
handleDelete(row) {
const warehouseIds = row.warehouseId || this.ids
this.$modal.confirm('是否确认删除各巷道重量统计编号为"' + warehouseIds + '"的数据项?').then(function() {
return delWeight(warehouseIds)
}).then(() => {
this.getList()
this.$modal.msgSuccess("删除成功")
}).catch(() => {})
},
/** 导出按钮操作 */
handleExport() {
this.download('search/weight/export', {
...this.queryParams
}, `weight_${new Date().getTime()}.xlsx`)
}
}
}
</script>