feat(asset): 添加资产位置管理功能

- 创建资产位置实体类 AmsAssetLocation,包含位置编码、名称、所属仓库等字段
- 实现资产位置控制器 AmsAssetLocationController,提供增删改查和导出功能
- 开发资产位置数据访问层 AmsAssetLocationMapper 及其XML映射文件
- 实现资产位置服务层 IAmsAssetLocationService 及其业务逻辑处理
- 添加资产位置新增、编辑、查看和列表页面的前端模板
- 实现位置编码唯一性校验和引用关系检查功能
- 集成仓库选择下拉框和启用状态字典数据展示
main
yangk 3 weeks ago
parent 1057e0ca3a
commit 66f350db6f

@ -0,0 +1,170 @@
package com.ruoyi.asset.controller;
import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.asset.domain.AmsAssetLocation;
import com.ruoyi.asset.domain.AmsWarehouse;
import com.ruoyi.asset.service.IAmsAssetLocationService;
import com.ruoyi.asset.service.IAmsWarehouseService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;
/**
* Controller
*
* @author Yangk
* @date 2026-06-04
*/
@Controller
@RequestMapping("/asset/location")
public class AmsAssetLocationController extends BaseController
{
private static final String ENABLED_YES = "Y";
private String prefix = "asset/location";
@Autowired
private IAmsAssetLocationService amsAssetLocationService;
@Autowired
private IAmsWarehouseService amsWarehouseService;
@RequiresPermissions("asset:location:view")
@GetMapping()
public String location(ModelMap mmap)
{
mmap.put("warehouseList", selectEnabledWarehouseList());
return prefix + "/location";
}
/**
*
*/
@RequiresPermissions("asset:location:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(AmsAssetLocation amsAssetLocation)
{
startPage();
List<AmsAssetLocation> list = amsAssetLocationService.selectAmsAssetLocationList(amsAssetLocation);
return getDataTable(list);
}
/**
*
*/
@RequiresPermissions("asset:location:export")
@Log(title = "资产位置", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(AmsAssetLocation amsAssetLocation)
{
List<AmsAssetLocation> list = amsAssetLocationService.selectAmsAssetLocationList(amsAssetLocation);
ExcelUtil<AmsAssetLocation> util = new ExcelUtil<AmsAssetLocation>(AmsAssetLocation.class);
return util.exportExcel(list, "资产位置数据");
}
/**
*
*/
@RequiresPermissions("asset:location:view")
@GetMapping("/view/{locationId}")
public String view(@PathVariable("locationId") Long locationId, ModelMap mmap)
{
AmsAssetLocation amsAssetLocation = amsAssetLocationService.selectAmsAssetLocationByLocationId(locationId);
mmap.put("amsAssetLocation", amsAssetLocation);
return prefix + "/view";
}
/**
*
*/
@RequiresPermissions("asset:location:add")
@GetMapping("/add")
public String add(ModelMap mmap)
{
mmap.put("warehouseList", selectEnabledWarehouseList());
return prefix + "/add";
}
/**
*
*/
@RequiresPermissions("asset:location:add")
@Log(title = "资产位置", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(AmsAssetLocation amsAssetLocation)
{
if (!amsAssetLocationService.checkLocationCodeUnique(amsAssetLocation))
{
return error("新增资产位置'" + amsAssetLocation.getLocationName() + "'失败,位置编码已存在");
}
amsAssetLocation.setCreateBy(getLoginName());
return toAjax(amsAssetLocationService.insertAmsAssetLocation(amsAssetLocation));
}
/**
*
*/
@RequiresPermissions("asset:location:edit")
@GetMapping("/edit/{locationId}")
public String edit(@PathVariable("locationId") Long locationId, ModelMap mmap)
{
AmsAssetLocation amsAssetLocation = amsAssetLocationService.selectAmsAssetLocationByLocationId(locationId);
mmap.put("amsAssetLocation", amsAssetLocation);
mmap.put("warehouseList", selectEnabledWarehouseList());
return prefix + "/edit";
}
/**
*
*/
@RequiresPermissions("asset:location:edit")
@Log(title = "资产位置", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(AmsAssetLocation amsAssetLocation)
{
if (!amsAssetLocationService.checkLocationCodeUnique(amsAssetLocation))
{
return error("修改资产位置'" + amsAssetLocation.getLocationName() + "'失败,位置编码已存在");
}
amsAssetLocation.setUpdateBy(getLoginName());
return toAjax(amsAssetLocationService.updateAmsAssetLocation(amsAssetLocation));
}
/**
*
*/
@RequiresPermissions("asset:location:remove")
@Log(title = "资产位置", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(amsAssetLocationService.deleteAmsAssetLocationByLocationIds(ids));
}
/**
*
*/
private List<AmsWarehouse> selectEnabledWarehouseList()
{
AmsWarehouse warehouse = new AmsWarehouse();
warehouse.setEnabled(ENABLED_YES);
return amsWarehouseService.selectAmsWarehouseList(warehouse);
}
}

@ -0,0 +1,145 @@
package com.ruoyi.asset.domain;
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;
/**
* ams_asset_location
*
* @author Yangk
* @date 2026-06-04
*/
public class AmsAssetLocation extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 位置ID */
private Long locationId;
/** 位置编码 */
@Excel(name = "位置编码")
private String locationCode;
/** 位置名称 */
@Excel(name = "位置名称")
private String locationName;
/** 所属仓库ID */
private Long warehouseId;
/** 所属仓库 */
@Excel(name = "所属仓库")
private String warehouseName;
/** 详细地址 */
@Excel(name = "详细地址")
private String detailAddress;
/** 启用状态Y启用N停用 */
@Excel(name = "启用状态Y启用N停用")
private String enabled;
/** 删除标志0存在1删除 */
private String delFlag;
public void setLocationId(Long locationId)
{
this.locationId = locationId;
}
public Long getLocationId()
{
return locationId;
}
public void setLocationCode(String locationCode)
{
this.locationCode = locationCode;
}
public String getLocationCode()
{
return locationCode;
}
public void setLocationName(String locationName)
{
this.locationName = locationName;
}
public String getLocationName()
{
return locationName;
}
public void setWarehouseId(Long warehouseId)
{
this.warehouseId = warehouseId;
}
public Long getWarehouseId()
{
return warehouseId;
}
public void setWarehouseName(String warehouseName)
{
this.warehouseName = warehouseName;
}
public String getWarehouseName()
{
return warehouseName;
}
public void setDetailAddress(String detailAddress)
{
this.detailAddress = detailAddress;
}
public String getDetailAddress()
{
return detailAddress;
}
public void setEnabled(String enabled)
{
this.enabled = enabled;
}
public String getEnabled()
{
return enabled;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("locationId", getLocationId())
.append("locationCode", getLocationCode())
.append("locationName", getLocationName())
.append("warehouseId", getWarehouseId())
.append("warehouseName", getWarehouseName())
.append("detailAddress", getDetailAddress())
.append("enabled", getEnabled())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("delFlag", getDelFlag())
.toString();
}
}

@ -0,0 +1,77 @@
package com.ruoyi.asset.mapper;
import java.util.List;
import com.ruoyi.asset.domain.AmsAssetLocation;
/**
* Mapper
*
* @author Yangk
* @date 2026-06-04
*/
public interface AmsAssetLocationMapper
{
/**
*
*
* @param locationId
* @return
*/
public AmsAssetLocation selectAmsAssetLocationByLocationId(Long locationId);
/**
*
*
* @param amsAssetLocation
* @return
*/
public List<AmsAssetLocation> selectAmsAssetLocationList(AmsAssetLocation amsAssetLocation);
/**
*
*
* @param locationCode
* @return
*/
public AmsAssetLocation checkLocationCodeUnique(String locationCode);
/**
*
*
* @param locationId ID
* @return
*/
public int countLocationReferences(Long locationId);
/**
*
*
* @param amsAssetLocation
* @return
*/
public int insertAmsAssetLocation(AmsAssetLocation amsAssetLocation);
/**
*
*
* @param amsAssetLocation
* @return
*/
public int updateAmsAssetLocation(AmsAssetLocation amsAssetLocation);
/**
*
*
* @param locationId
* @return
*/
public int deleteAmsAssetLocationByLocationId(Long locationId);
/**
*
*
* @param locationIds
* @return
*/
public int deleteAmsAssetLocationByLocationIds(String[] locationIds);
}

@ -0,0 +1,69 @@
package com.ruoyi.asset.service;
import java.util.List;
import com.ruoyi.asset.domain.AmsAssetLocation;
/**
* Service
*
* @author Yangk
* @date 2026-06-04
*/
public interface IAmsAssetLocationService
{
/**
*
*
* @param locationId
* @return
*/
public AmsAssetLocation selectAmsAssetLocationByLocationId(Long locationId);
/**
*
*
* @param amsAssetLocation
* @return
*/
public List<AmsAssetLocation> selectAmsAssetLocationList(AmsAssetLocation amsAssetLocation);
/**
*
*
* @param amsAssetLocation
* @return
*/
public boolean checkLocationCodeUnique(AmsAssetLocation amsAssetLocation);
/**
*
*
* @param amsAssetLocation
* @return
*/
public int insertAmsAssetLocation(AmsAssetLocation amsAssetLocation);
/**
*
*
* @param amsAssetLocation
* @return
*/
public int updateAmsAssetLocation(AmsAssetLocation amsAssetLocation);
/**
*
*
* @param locationIds
* @return
*/
public int deleteAmsAssetLocationByLocationIds(String locationIds);
/**
*
*
* @param locationId
* @return
*/
public int deleteAmsAssetLocationByLocationId(Long locationId);
}

@ -0,0 +1,182 @@
package com.ruoyi.asset.service.impl;
import java.util.List;
import com.ruoyi.asset.domain.AmsWarehouse;
import com.ruoyi.asset.service.IAmsWarehouseService;
import com.ruoyi.common.constant.UserConstants;
import com.ruoyi.common.exception.ServiceException;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.asset.mapper.AmsAssetLocationMapper;
import com.ruoyi.asset.domain.AmsAssetLocation;
import com.ruoyi.asset.service.IAmsAssetLocationService;
import com.ruoyi.common.core.text.Convert;
/**
* Service
*
* @author Yangk
* @date 2026-06-04
*/
@Service
public class AmsAssetLocationServiceImpl implements IAmsAssetLocationService
{
private static final String ENABLED_YES = "Y";
private static final String DEL_FLAG_NORMAL = "0";
@Autowired
private AmsAssetLocationMapper amsAssetLocationMapper;
@Autowired
private IAmsWarehouseService amsWarehouseService;
/**
*
*
* @param locationId
* @return
*/
@Override
public AmsAssetLocation selectAmsAssetLocationByLocationId(Long locationId)
{
return amsAssetLocationMapper.selectAmsAssetLocationByLocationId(locationId);
}
/**
*
*
* @param amsAssetLocation
* @return
*/
@Override
public List<AmsAssetLocation> selectAmsAssetLocationList(AmsAssetLocation amsAssetLocation)
{
return amsAssetLocationMapper.selectAmsAssetLocationList(amsAssetLocation);
}
/**
*
*
* @param amsAssetLocation
* @return
*/
@Override
public boolean checkLocationCodeUnique(AmsAssetLocation amsAssetLocation)
{
if (StringUtils.isEmpty(amsAssetLocation.getLocationCode()))
{
return UserConstants.UNIQUE;
}
Long locationId = StringUtils.isNull(amsAssetLocation.getLocationId()) ? -1L : amsAssetLocation.getLocationId();
AmsAssetLocation info = amsAssetLocationMapper.checkLocationCodeUnique(amsAssetLocation.getLocationCode());
if (StringUtils.isNotNull(info) && info.getLocationId().longValue() != locationId.longValue())
{
return UserConstants.NOT_UNIQUE;
}
return UserConstants.UNIQUE;
}
/**
*
*
* @param amsAssetLocation
* @return
*/
@Override
public int insertAmsAssetLocation(AmsAssetLocation amsAssetLocation)
{
fillLocationDefaults(amsAssetLocation);
checkEnabledWarehouse(amsAssetLocation.getWarehouseId());
amsAssetLocation.setDelFlag(DEL_FLAG_NORMAL);
amsAssetLocation.setCreateTime(DateUtils.getNowDate());
return amsAssetLocationMapper.insertAmsAssetLocation(amsAssetLocation);
}
/**
*
*
* @param amsAssetLocation
* @return
*/
@Override
public int updateAmsAssetLocation(AmsAssetLocation amsAssetLocation)
{
fillLocationDefaults(amsAssetLocation);
checkEnabledWarehouse(amsAssetLocation.getWarehouseId());
amsAssetLocation.setUpdateTime(DateUtils.getNowDate());
return amsAssetLocationMapper.updateAmsAssetLocation(amsAssetLocation);
}
/**
*
*
* @param locationIds
* @return
*/
@Override
public int deleteAmsAssetLocationByLocationIds(String locationIds)
{
String[] ids = Convert.toStrArray(locationIds);
for (String id : ids)
{
checkLocationReferenced(Long.valueOf(id));
}
return amsAssetLocationMapper.deleteAmsAssetLocationByLocationIds(ids);
}
/**
*
*
* @param locationId
* @return
*/
@Override
public int deleteAmsAssetLocationByLocationId(Long locationId)
{
checkLocationReferenced(locationId);
return amsAssetLocationMapper.deleteAmsAssetLocationByLocationId(locationId);
}
/**
*
*/
private void checkEnabledWarehouse(Long warehouseId)
{
if (StringUtils.isNull(warehouseId))
{
throw new ServiceException("所属仓库不能为空");
}
AmsWarehouse warehouse = amsWarehouseService.selectAmsWarehouseByWarehouseId(warehouseId);
if (StringUtils.isNull(warehouse) || !StringUtils.equals(ENABLED_YES, warehouse.getEnabled()))
{
throw new ServiceException("所属仓库不存在或已停用");
}
}
/**
*
*/
private void checkLocationReferenced(Long locationId)
{
AmsAssetLocation location = selectAmsAssetLocationByLocationId(locationId);
if (StringUtils.isNotNull(location) && amsAssetLocationMapper.countLocationReferences(locationId) > 0)
{
throw new ServiceException(String.format("资产位置【%1$s】已被引用不允许删除", location.getLocationName()));
}
}
/**
*
*/
private void fillLocationDefaults(AmsAssetLocation amsAssetLocation)
{
if (StringUtils.isEmpty(amsAssetLocation.getEnabled()))
{
amsAssetLocation.setEnabled(ENABLED_YES);
}
}
}

@ -0,0 +1,122 @@
<?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.asset.mapper.AmsAssetLocationMapper">
<resultMap type="AmsAssetLocation" id="AmsAssetLocationResult">
<result property="locationId" column="location_id" />
<result property="locationCode" column="location_code" />
<result property="locationName" column="location_name" />
<result property="warehouseId" column="warehouse_id" />
<result property="warehouseName" column="warehouse_name" />
<result property="detailAddress" column="detail_address" />
<result property="enabled" column="enabled" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="delFlag" column="del_flag" />
</resultMap>
<sql id="selectAmsAssetLocationVo">
select l.location_id, l.location_code, l.location_name, l.warehouse_id, w.warehouse_name, l.detail_address, l.enabled, l.create_by, l.create_time, l.update_by, l.update_time, l.remark, l.del_flag
from ams_asset_location l
left join ams_warehouse w on l.warehouse_id = w.warehouse_id and w.del_flag = '0'
</sql>
<select id="selectAmsAssetLocationList" parameterType="AmsAssetLocation" resultMap="AmsAssetLocationResult">
<include refid="selectAmsAssetLocationVo"/>
<where>
l.del_flag = '0'
<if test="locationCode != null and locationCode != ''"> and l.location_code = #{locationCode}</if>
<if test="locationName != null and locationName != ''"> and l.location_name like concat('%', #{locationName}, '%')</if>
<if test="warehouseId != null "> and l.warehouse_id = #{warehouseId}</if>
<if test="enabled != null and enabled != ''"> and l.enabled = #{enabled}</if>
</where>
</select>
<select id="selectAmsAssetLocationByLocationId" parameterType="Long" resultMap="AmsAssetLocationResult">
<include refid="selectAmsAssetLocationVo"/>
where l.location_id = #{locationId} and l.del_flag = '0'
</select>
<select id="checkLocationCodeUnique" parameterType="String" resultMap="AmsAssetLocationResult">
<include refid="selectAmsAssetLocationVo"/>
where l.location_code = #{locationCode} and l.del_flag = '0' limit 1
</select>
<select id="countLocationReferences" parameterType="Long" resultType="int">
select
(select count(1) from ams_asset where location_id = #{locationId} and del_flag = '0')
+ (select count(1) from ams_asset_lifecycle_log where del_flag = '0' and (before_location_id = #{locationId} or after_location_id = #{locationId}))
+ (select count(1) from ams_borrow_order_item where del_flag = '0' and (before_location_id = #{locationId} or return_location_id = #{locationId}))
+ (select count(1) from ams_inbound_order_item where location_id = #{locationId} and del_flag = '0')
+ (select count(1) from ams_inventory_task where location_id = #{locationId} and del_flag = '0')
+ (select count(1) from ams_inventory_task_item where del_flag = '0' and (book_location_id = #{locationId} or inventory_location_id = #{locationId}))
+ (select count(1) from ams_receive_order_item where before_location_id = #{locationId} and del_flag = '0')
+ (select count(1) from ams_return_order_item where after_location_id = #{locationId} and del_flag = '0')
+ (select count(1) from ams_transfer_order_item where del_flag = '0' and (old_location_id = #{locationId} or new_location_id = #{locationId}))
</select>
<insert id="insertAmsAssetLocation" parameterType="AmsAssetLocation" useGeneratedKeys="true" keyProperty="locationId">
insert into ams_asset_location
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="locationCode != null and locationCode != ''">location_code,</if>
<if test="locationName != null and locationName != ''">location_name,</if>
<if test="warehouseId != null">warehouse_id,</if>
<if test="detailAddress != null">detail_address,</if>
<if test="enabled != null and enabled != ''">enabled,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="delFlag != null and delFlag != ''">del_flag,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="locationCode != null and locationCode != ''">#{locationCode},</if>
<if test="locationName != null and locationName != ''">#{locationName},</if>
<if test="warehouseId != null">#{warehouseId},</if>
<if test="detailAddress != null">#{detailAddress},</if>
<if test="enabled != null and enabled != ''">#{enabled},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="delFlag != null and delFlag != ''">#{delFlag},</if>
</trim>
</insert>
<update id="updateAmsAssetLocation" parameterType="AmsAssetLocation">
update ams_asset_location
<trim prefix="SET" suffixOverrides=",">
<if test="locationCode != null and locationCode != ''">location_code = #{locationCode},</if>
<if test="locationName != null and locationName != ''">location_name = #{locationName},</if>
<if test="warehouseId != null">warehouse_id = #{warehouseId},</if>
<if test="detailAddress != null">detail_address = #{detailAddress},</if>
<if test="enabled != null and enabled != ''">enabled = #{enabled},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
</trim>
where location_id = #{locationId}
</update>
<update id="deleteAmsAssetLocationByLocationId" parameterType="Long">
update ams_asset_location set del_flag = '1' where location_id = #{locationId}
</update>
<update id="deleteAmsAssetLocationByLocationIds" parameterType="String">
update ams_asset_location set del_flag = '1' where location_id in
<foreach item="locationId" collection="array" open="(" separator="," close=")">
#{locationId}
</foreach>
</update>
</mapper>

@ -0,0 +1,79 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增资产位置')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-location-add">
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">位置编码:</label>
<div class="col-sm-8">
<input name="locationCode" class="form-control" type="text" required>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">位置名称:</label>
<div class="col-sm-8">
<input name="locationName" class="form-control" type="text" required>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">所属仓库:</label>
<div class="col-sm-8">
<select name="warehouseId" class="form-control" required>
<option value="">请选择</option>
<option th:each="warehouse : ${warehouseList}" th:text="${warehouse.warehouseName}" th:value="${warehouse.warehouseId}"></option>
</select>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">详细地址:</label>
<div class="col-sm-8">
<input name="detailAddress" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">启用状态:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('ams_enabled_status')}">
<input type="radio" th:id="${'enabled_' + dict.dictCode}" name="enabled" th:value="${dict.dictValue}" th:checked="${dict.default}" required>
<label th:for="${'enabled_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">备注:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control"></textarea>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "asset/location"
$("#form-location-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-location-add').serialize());
}
}
</script>
</body>
</html>

@ -0,0 +1,80 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改资产位置')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-location-edit" th:object="${amsAssetLocation}">
<input name="locationId" th:field="*{locationId}" type="hidden">
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">位置编码:</label>
<div class="col-sm-8">
<input name="locationCode" th:field="*{locationCode}" class="form-control" type="text" required>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">位置名称:</label>
<div class="col-sm-8">
<input name="locationName" th:field="*{locationName}" class="form-control" type="text" required>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">所属仓库:</label>
<div class="col-sm-8">
<select name="warehouseId" th:field="*{warehouseId}" class="form-control" required>
<option value="">请选择</option>
<option th:each="warehouse : ${warehouseList}" th:text="${warehouse.warehouseName}" th:value="${warehouse.warehouseId}"></option>
</select>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">详细地址:</label>
<div class="col-sm-8">
<input name="detailAddress" th:field="*{detailAddress}" class="form-control" type="text">
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label is-required">启用状态:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('ams_enabled_status')}">
<input type="radio" th:id="${'enabled_' + dict.dictCode}" name="enabled" th:value="${dict.dictValue}" th:field="*{enabled}" required>
<label th:for="${'enabled_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
</div>
<div class="col-xs-6">
<div class="form-group">
<label class="col-sm-4 control-label">备注:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control">[[*{remark}]]</textarea>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "asset/location";
$("#form-location-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-location-edit').serialize());
}
}
</script>
</body>
</html>

@ -0,0 +1,130 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
<th:block th:include="include :: header('资产位置列表')" />
</head>
<body class="gray-bg">
<div class="container-div">
<div class="row">
<div class="col-sm-12 search-collapse">
<form id="formId">
<div class="select-list">
<ul>
<li>
<label>位置编码:</label>
<input type="text" name="locationCode"/>
</li>
<li>
<label>位置名称:</label>
<input type="text" name="locationName"/>
</li>
<li>
<label>所属仓库:</label>
<select name="warehouseId">
<option value="">所有</option>
<option th:each="warehouse : ${warehouseList}" th:text="${warehouse.warehouseName}" th:value="${warehouse.warehouseId}"></option>
</select>
</li>
<li>
<label>启用状态:</label>
<select name="enabled" th:with="type=${@dict.getType('ams_enabled_status')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
</li>
</ul>
</div>
</form>
</div>
<div class="btn-group-sm" id="toolbar" role="group">
<a class="btn btn-success" onclick="$.operate.add()" shiro:hasPermission="asset:location:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="asset:location:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="asset:location:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="asset:location:export">
<i class="fa fa-download"></i> 导出
</a>
</div>
<div class="col-sm-12 select-table table-striped">
<table id="bootstrap-table"></table>
</div>
</div>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var editFlag = [[${@permission.hasPermi('asset:location:edit')}]];
var removeFlag = [[${@permission.hasPermi('asset:location:remove')}]];
var enabledDatas = [[${@dict.getType('ams_enabled_status')}]];
var prefix = ctx + "asset/location";
$(function() {
var options = {
url: prefix + "/list",
viewUrl: prefix + "/view/{id}",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
exportUrl: prefix + "/export",
modalName: "资产位置",
columns: [{
checkbox: true
},
{
field: 'locationId',
title: '位置ID',
visible: false
},
{
field: 'locationCode',
title: '位置编码'
},
{
field: 'locationName',
title: '位置名称'
},
{
field: 'warehouseName',
title: '所属仓库'
},
{
field: 'detailAddress',
title: '详细地址'
},
{
field: 'enabled',
title: '启用状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(enabledDatas, value);
}
},
{
field: 'remark',
title: '备注'
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="$.operate.view(\'' + row.locationId + '\')"><i class="fa fa-eye"></i>查看</a> ');
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.locationId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.locationId + '\')"><i class="fa fa-remove"></i>删除</a>');
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

@ -0,0 +1,68 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('资产位置详细')" />
</head>
<body>
<div class="main-content">
<form class="form-horizontal" th:object="${amsAssetLocation}">
<h4 class="form-header h4">基本信息</h4>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">位置编码:</label>
<div class="col-sm-8">
<p class="form-control-plaintext" th:text="*{locationCode}"></p>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">位置名称:</label>
<div class="col-sm-8">
<p class="form-control-plaintext" th:text="*{locationName}"></p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">所属仓库:</label>
<div class="col-sm-8">
<p class="form-control-plaintext" th:text="*{warehouseName}"></p>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">详细地址:</label>
<div class="col-sm-8">
<p class="form-control-plaintext" th:text="*{detailAddress}"></p>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">启用状态:</label>
<div class="col-sm-8">
<p class="form-control-plaintext" th:text="*{@dict.getLabel('ams_enabled_status', enabled)}"></p>
</div>
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<label class="col-sm-4 control-label">备注:</label>
<div class="col-sm-8">
<p class="form-control-plaintext" th:text="*{remark}"></p>
</div>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
</body>
</html>
Loading…
Cancel
Save