feat(asset): 新增资产报废处置功能模块
- 创建报废处置申请页面,包含基本信息和明细信息表格 - 实现报废单据相关实体类 AmsDisposalOrder 和 AmsDisposalOrderItem - 开发报废管理控制器 AmsDisposalOrderController 提供完整的CRUD操作 - 设计报废操作上下文类 AmsDisposalOperateContext 管理操作人员信息 - 实现报废单据的数据访问层和业务逻辑层功能 - 添加资产选择功能支持批量添加待报废资产 - 实现报废单据的状态流转包括提交、确认、驳回等操作 - 集成权限控制和数据验证机制确保操作安全性main
parent
d98a5046be
commit
a26d6dc54f
@ -0,0 +1,25 @@
|
||||
package com.ruoyi.asset.constant;
|
||||
|
||||
/**
|
||||
* 报废单状态常量定义
|
||||
*
|
||||
* @author Yangk
|
||||
*/
|
||||
public final class DisposalOrderStatus
|
||||
{
|
||||
/** 草稿 */
|
||||
public static final String DRAFT = "DRAFT";
|
||||
|
||||
/** 待确认 */
|
||||
public static final String PENDING_CONFIRM = "PENDING_CONFIRM";
|
||||
|
||||
/** 已报废 */
|
||||
public static final String DISPOSED_DONE = "DISPOSED_DONE";
|
||||
|
||||
/** 已驳回 */
|
||||
public static final String REJECTED = "REJECTED";
|
||||
|
||||
private DisposalOrderStatus()
|
||||
{
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,114 @@
|
||||
package com.ruoyi.asset.mapper;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.asset.domain.AmsAsset;
|
||||
import com.ruoyi.asset.domain.AmsDisposalOrder;
|
||||
import com.ruoyi.asset.domain.AmsDisposalOrderItem;
|
||||
|
||||
/**
|
||||
* 报废管理Mapper接口
|
||||
*
|
||||
* @author Yangk
|
||||
* @date 2026-06-17
|
||||
*/
|
||||
public interface AmsDisposalOrderMapper
|
||||
{
|
||||
/**
|
||||
* 查询报废管理
|
||||
*
|
||||
* @param orderId 报废管理主键
|
||||
* @return 报废管理
|
||||
*/
|
||||
public AmsDisposalOrder selectAmsDisposalOrderByOrderId(Long orderId);
|
||||
|
||||
/**
|
||||
* 查询报废管理列表
|
||||
*
|
||||
* @param amsDisposalOrder 报废管理
|
||||
* @return 报废管理集合
|
||||
*/
|
||||
public List<AmsDisposalOrder> selectAmsDisposalOrderList(AmsDisposalOrder amsDisposalOrder);
|
||||
|
||||
/**
|
||||
* 新增报废管理
|
||||
*
|
||||
* @param amsDisposalOrder 报废管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAmsDisposalOrder(AmsDisposalOrder amsDisposalOrder);
|
||||
|
||||
/**
|
||||
* 修改报废管理
|
||||
*
|
||||
* @param amsDisposalOrder 报废管理
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAmsDisposalOrder(AmsDisposalOrder amsDisposalOrder);
|
||||
|
||||
/**
|
||||
* 删除报废管理
|
||||
*
|
||||
* @param orderId 报废管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAmsDisposalOrderByOrderId(Long orderId);
|
||||
|
||||
/**
|
||||
* 批量删除报废管理
|
||||
*
|
||||
* @param orderIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAmsDisposalOrderByOrderIds(String[] orderIds);
|
||||
|
||||
/**
|
||||
* 批量删除报废单明细
|
||||
*
|
||||
* @param orderIds 需要删除的数据主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAmsDisposalOrderItemByOrderIds(String[] orderIds);
|
||||
|
||||
/**
|
||||
* 批量新增报废单明细
|
||||
*
|
||||
* @param amsDisposalOrderItemList 报废单明细列表
|
||||
* @return 结果
|
||||
*/
|
||||
public int batchAmsDisposalOrderItem(List<AmsDisposalOrderItem> amsDisposalOrderItemList);
|
||||
|
||||
|
||||
/**
|
||||
* 通过报废管理主键删除报废单明细信息
|
||||
*
|
||||
* @param orderId 报废管理ID
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAmsDisposalOrderItemByOrderId(Long orderId);
|
||||
|
||||
/**
|
||||
* 悲观锁锁定单据
|
||||
*
|
||||
* @param orderId 单据ID
|
||||
* @return 结果
|
||||
*/
|
||||
public AmsDisposalOrder selectAmsDisposalOrderByOrderIdForUpdate(Long orderId);
|
||||
|
||||
/**
|
||||
* 查询可用于报废的资产列表
|
||||
*
|
||||
* @param asset 资产查询条件
|
||||
* @param currentOrderId 当前报废单ID
|
||||
* @return 资产列表
|
||||
*/
|
||||
public List<AmsAsset> selectAvailableDisposalAssetList(@org.apache.ibatis.annotations.Param("asset") AmsAsset asset, @org.apache.ibatis.annotations.Param("currentOrderId") Long currentOrderId);
|
||||
|
||||
/**
|
||||
* 查询资产被其他活跃报废单占用的次数
|
||||
*
|
||||
* @param assetId 资产ID
|
||||
* @param currentOrderId 当前报废单ID
|
||||
* @return 占用单据数量
|
||||
*/
|
||||
public int countOtherActiveDisposalOrderByAssetId(@org.apache.ibatis.annotations.Param("assetId") Long assetId, @org.apache.ibatis.annotations.Param("currentOrderId") Long currentOrderId);
|
||||
}
|
||||
@ -0,0 +1,101 @@
|
||||
package com.ruoyi.asset.service;
|
||||
|
||||
import java.util.List;
|
||||
import com.ruoyi.asset.domain.AmsDisposalOperateContext;
|
||||
import com.ruoyi.asset.domain.AmsDisposalOrder;
|
||||
|
||||
/**
|
||||
* 报废管理Service接口
|
||||
*
|
||||
* @author Yangk
|
||||
* @date 2026-06-17
|
||||
*/
|
||||
public interface IAmsDisposalOrderService
|
||||
{
|
||||
/**
|
||||
* 查询报废管理
|
||||
*
|
||||
* @param orderId 报废管理主键
|
||||
* @return 报废管理
|
||||
*/
|
||||
public AmsDisposalOrder selectAmsDisposalOrderByOrderId(Long orderId);
|
||||
|
||||
/**
|
||||
* 查询报废管理列表
|
||||
*
|
||||
* @param amsDisposalOrder 报废管理
|
||||
* @return 报废管理集合
|
||||
*/
|
||||
public List<AmsDisposalOrder> selectAmsDisposalOrderList(AmsDisposalOrder amsDisposalOrder);
|
||||
|
||||
/**
|
||||
* 新增报废管理
|
||||
*
|
||||
* @param amsDisposalOrder 报废管理
|
||||
* @param operateContext 操作上下文
|
||||
* @return 结果
|
||||
*/
|
||||
public int insertAmsDisposalOrder(AmsDisposalOrder amsDisposalOrder, AmsDisposalOperateContext operateContext);
|
||||
|
||||
/**
|
||||
* 修改报废管理
|
||||
*
|
||||
* @param amsDisposalOrder 报废管理
|
||||
* @param operateContext 操作上下文
|
||||
* @return 结果
|
||||
*/
|
||||
public int updateAmsDisposalOrder(AmsDisposalOrder amsDisposalOrder, AmsDisposalOperateContext operateContext);
|
||||
|
||||
/**
|
||||
* 批量删除报废管理
|
||||
*
|
||||
* @param orderIds 需要删除的报废管理主键集合
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAmsDisposalOrderByOrderIds(String orderIds);
|
||||
|
||||
/**
|
||||
* 删除报废管理信息
|
||||
*
|
||||
* @param orderId 报废管理主键
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteAmsDisposalOrderByOrderId(Long orderId);
|
||||
|
||||
/**
|
||||
* 提交报废申请
|
||||
*
|
||||
* @param orderId 报废单ID
|
||||
* @param operateContext 操作上下文
|
||||
* @return 结果
|
||||
*/
|
||||
public int submitDisposal(Long orderId, AmsDisposalOperateContext operateContext);
|
||||
|
||||
/**
|
||||
* 确认报废处置
|
||||
*
|
||||
* @param orderId 报废单ID
|
||||
* @param operateContext 操作上下文
|
||||
* @return 结果
|
||||
*/
|
||||
public int confirmDisposal(Long orderId, AmsDisposalOperateContext operateContext);
|
||||
|
||||
/**
|
||||
* 驳回报废申请
|
||||
*
|
||||
* @param orderId 报废单ID
|
||||
* @param rejectReason 驳回原因
|
||||
* @param operateContext 操作上下文
|
||||
* @return 结果
|
||||
*/
|
||||
public int rejectDisposal(Long orderId, String rejectReason, AmsDisposalOperateContext operateContext);
|
||||
|
||||
/**
|
||||
* 查询可用于报废的资产列表
|
||||
*
|
||||
* @param asset 资产查询条件
|
||||
* @param currentOrderId 当前报废单ID
|
||||
* @return 资产列表
|
||||
*/
|
||||
public List<com.ruoyi.asset.domain.AmsAsset> selectAvailableDisposalAssetList(com.ruoyi.asset.domain.AmsAsset asset, Long currentOrderId);
|
||||
}
|
||||
@ -0,0 +1,280 @@
|
||||
<?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.AmsDisposalOrderMapper">
|
||||
|
||||
<resultMap type="AmsDisposalOrder" id="AmsDisposalOrderResult">
|
||||
<result property="orderId" column="order_id" />
|
||||
<result property="disposalNo" column="disposal_no" />
|
||||
<result property="applicantId" column="applicant_id" />
|
||||
<result property="applicantName" column="applicant_name" />
|
||||
<result property="applyDeptId" column="apply_dept_id" />
|
||||
<result property="applyDeptName" column="apply_dept_name" />
|
||||
<result property="confirmUserId" column="confirm_user_id" />
|
||||
<result property="confirmUserName" column="confirm_user_name" />
|
||||
<result property="confirmTime" column="confirm_time" />
|
||||
<result property="rejectReason" column="reject_reason" />
|
||||
<result property="disposalMethod" column="disposal_method" />
|
||||
<result property="disposalTime" column="disposal_time" />
|
||||
<result property="orderStatus" column="order_status" />
|
||||
<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>
|
||||
|
||||
<resultMap id="AmsDisposalOrderAmsDisposalOrderItemResult" type="AmsDisposalOrder" extends="AmsDisposalOrderResult">
|
||||
<collection property="amsDisposalOrderItemList" ofType="AmsDisposalOrderItem" column="order_id" select="selectAmsDisposalOrderItemList" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="AmsAsset" id="AvailableDisposalAssetResult">
|
||||
<result property="assetId" column="asset_id" />
|
||||
<result property="assetCode" column="asset_code" />
|
||||
<result property="assetName" column="asset_name" />
|
||||
<result property="categoryId" column="category_id" />
|
||||
<result property="categoryCode" column="category_code" />
|
||||
<result property="categoryName" column="category_name" />
|
||||
<result property="specModel" column="spec_model" />
|
||||
<result property="brand" column="brand" />
|
||||
<result property="assetStatus" column="asset_status" />
|
||||
<result property="warehouseId" column="warehouse_id" />
|
||||
<result property="warehouseCode" column="warehouse_code" />
|
||||
<result property="warehouseName" column="warehouse_name" />
|
||||
<result property="locationId" column="location_id" />
|
||||
<result property="locationCode" column="location_code" />
|
||||
<result property="locationName" column="location_name" />
|
||||
<result property="tagCode" column="tag_code" />
|
||||
</resultMap>
|
||||
|
||||
<resultMap type="AmsDisposalOrderItem" id="AmsDisposalOrderItemResult">
|
||||
<result property="itemId" column="item_id" />
|
||||
<result property="orderId" column="order_id" />
|
||||
<result property="disposalNo" column="disposal_no" />
|
||||
<result property="assetId" column="asset_id" />
|
||||
<result property="assetCode" column="asset_code" />
|
||||
<result property="assetName" column="asset_name" />
|
||||
<result property="categoryId" column="category_id" />
|
||||
<result property="categoryCode" column="category_code" />
|
||||
<result property="categoryName" column="category_name" />
|
||||
<result property="specModel" column="spec_model" />
|
||||
<result property="brand" column="brand" />
|
||||
<result property="disposalReason" column="disposal_reason" />
|
||||
<result property="disposalRemark" column="disposal_remark" />
|
||||
<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="selectAmsDisposalOrderVo">
|
||||
select order_id, disposal_no, applicant_id, applicant_name, apply_dept_id, apply_dept_name, confirm_user_id, confirm_user_name, confirm_time, reject_reason, disposal_method, disposal_time, order_status, create_by, create_time, update_by, update_time, remark, del_flag from ams_disposal_order
|
||||
</sql>
|
||||
|
||||
<select id="selectAmsDisposalOrderList" parameterType="AmsDisposalOrder" resultMap="AmsDisposalOrderResult">
|
||||
<include refid="selectAmsDisposalOrderVo"/>
|
||||
<where>
|
||||
del_flag = '0'
|
||||
<if test="disposalNo != null and disposalNo != ''"> and disposal_no like concat(#{disposalNo}, '%')</if>
|
||||
<if test="applicantId != null "> and applicant_id = #{applicantId}</if>
|
||||
<if test="applicantName != null and applicantName != ''"> and applicant_name like concat('%', #{applicantName}, '%')</if>
|
||||
<if test="applyDeptId != null "> and apply_dept_id = #{applyDeptId}</if>
|
||||
<if test="applyDeptName != null and applyDeptName != ''"> and apply_dept_name like concat('%', #{applyDeptName}, '%')</if>
|
||||
<if test="confirmUserId != null "> and confirm_user_id = #{confirmUserId}</if>
|
||||
<if test="confirmUserName != null and confirmUserName != ''"> and confirm_user_name like concat('%', #{confirmUserName}, '%')</if>
|
||||
<if test="confirmTime != null "> and confirm_time = #{confirmTime}</if>
|
||||
<if test="rejectReason != null and rejectReason != ''"> and reject_reason = #{rejectReason}</if>
|
||||
<if test="disposalMethod != null and disposalMethod != ''"> and disposal_method = #{disposalMethod}</if>
|
||||
<if test="disposalTime != null "> and disposal_time = #{disposalTime}</if>
|
||||
<if test="params.beginDisposalTime != null and params.beginDisposalTime != ''">
|
||||
and disposal_time >= #{params.beginDisposalTime}
|
||||
</if>
|
||||
<if test="params.endDisposalTime != null and params.endDisposalTime != ''">
|
||||
and disposal_time < date_add(#{params.endDisposalTime}, interval 1 day)
|
||||
</if>
|
||||
<if test="orderStatus != null and orderStatus != ''"> and order_status = #{orderStatus}</if>
|
||||
<if test="assetCode != null and assetCode != ''">
|
||||
and exists (
|
||||
select 1
|
||||
from ams_disposal_order_item item
|
||||
where item.order_id = ams_disposal_order.order_id
|
||||
and item.del_flag = '0'
|
||||
and item.asset_code like concat('%', #{assetCode}, '%')
|
||||
)
|
||||
</if>
|
||||
</where>
|
||||
order by create_time desc, order_id desc
|
||||
</select>
|
||||
|
||||
<select id="selectAmsDisposalOrderByOrderId" parameterType="Long" resultMap="AmsDisposalOrderAmsDisposalOrderItemResult">
|
||||
select order_id, disposal_no, applicant_id, applicant_name, apply_dept_id, apply_dept_name, confirm_user_id, confirm_user_name, confirm_time, reject_reason, disposal_method, disposal_time, order_status, create_by, create_time, update_by, update_time, remark, del_flag
|
||||
from ams_disposal_order
|
||||
where order_id = #{orderId} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<select id="selectAmsDisposalOrderByOrderIdForUpdate" parameterType="Long" resultMap="AmsDisposalOrderAmsDisposalOrderItemResult">
|
||||
select order_id, disposal_no, applicant_id, applicant_name, apply_dept_id, apply_dept_name, confirm_user_id, confirm_user_name, confirm_time, reject_reason, disposal_method, disposal_time, order_status, create_by, create_time, update_by, update_time, remark, del_flag
|
||||
from ams_disposal_order
|
||||
where order_id = #{orderId} and del_flag = '0'
|
||||
for update
|
||||
</select>
|
||||
|
||||
<select id="selectAmsDisposalOrderItemList" resultMap="AmsDisposalOrderItemResult">
|
||||
select item_id, order_id, disposal_no, asset_id, asset_code, asset_name, category_id, category_code, category_name, spec_model, brand, disposal_reason, disposal_remark, create_by, create_time, update_by, update_time, remark, del_flag
|
||||
from ams_disposal_order_item
|
||||
where order_id = #{order_id} and del_flag = '0'
|
||||
</select>
|
||||
|
||||
<insert id="insertAmsDisposalOrder" parameterType="AmsDisposalOrder" useGeneratedKeys="true" keyProperty="orderId">
|
||||
insert into ams_disposal_order
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="disposalNo != null and disposalNo != ''">disposal_no,</if>
|
||||
<if test="applicantId != null">applicant_id,</if>
|
||||
<if test="applicantName != null">applicant_name,</if>
|
||||
<if test="applyDeptId != null">apply_dept_id,</if>
|
||||
<if test="applyDeptName != null">apply_dept_name,</if>
|
||||
<if test="confirmUserId != null">confirm_user_id,</if>
|
||||
<if test="confirmUserName != null">confirm_user_name,</if>
|
||||
<if test="confirmTime != null">confirm_time,</if>
|
||||
<if test="rejectReason != null">reject_reason,</if>
|
||||
<if test="disposalMethod != null">disposal_method,</if>
|
||||
<if test="disposalTime != null">disposal_time,</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">order_status,</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="disposalNo != null and disposalNo != ''">#{disposalNo},</if>
|
||||
<if test="applicantId != null">#{applicantId},</if>
|
||||
<if test="applicantName != null">#{applicantName},</if>
|
||||
<if test="applyDeptId != null">#{applyDeptId},</if>
|
||||
<if test="applyDeptName != null">#{applyDeptName},</if>
|
||||
<if test="confirmUserId != null">#{confirmUserId},</if>
|
||||
<if test="confirmUserName != null">#{confirmUserName},</if>
|
||||
<if test="confirmTime != null">#{confirmTime},</if>
|
||||
<if test="rejectReason != null">#{rejectReason},</if>
|
||||
<if test="disposalMethod != null">#{disposalMethod},</if>
|
||||
<if test="disposalTime != null">#{disposalTime},</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">#{orderStatus},</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="updateAmsDisposalOrder" parameterType="AmsDisposalOrder">
|
||||
update ams_disposal_order
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="disposalNo != null and disposalNo != ''">disposal_no = #{disposalNo},</if>
|
||||
<if test="applicantId != null">applicant_id = #{applicantId},</if>
|
||||
<if test="applicantName != null">applicant_name = #{applicantName},</if>
|
||||
<if test="applyDeptId != null">apply_dept_id = #{applyDeptId},</if>
|
||||
<if test="applyDeptName != null">apply_dept_name = #{applyDeptName},</if>
|
||||
<if test="confirmUserId != null">confirm_user_id = #{confirmUserId},</if>
|
||||
<if test="confirmUserName != null">confirm_user_name = #{confirmUserName},</if>
|
||||
<if test="confirmTime != null">confirm_time = #{confirmTime},</if>
|
||||
<if test="rejectReason != null">reject_reason = #{rejectReason},</if>
|
||||
<if test="disposalMethod != null">disposal_method = #{disposalMethod},</if>
|
||||
<if test="disposalTime != null">disposal_time = #{disposalTime},</if>
|
||||
<if test="orderStatus != null and orderStatus != ''">order_status = #{orderStatus},</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 order_id = #{orderId} and del_flag = '0'
|
||||
<if test="params.expectedOrderStatus != null and params.expectedOrderStatus != ''">
|
||||
and order_status = #{params.expectedOrderStatus}
|
||||
</if>
|
||||
</update>
|
||||
|
||||
<update id="deleteAmsDisposalOrderByOrderId" parameterType="Long">
|
||||
update ams_disposal_order set del_flag = '1' where order_id = #{orderId} and del_flag = '0' and order_status = 'DRAFT'
|
||||
</update>
|
||||
|
||||
<update id="deleteAmsDisposalOrderByOrderIds" parameterType="String">
|
||||
update ams_disposal_order set del_flag = '1' where order_id in
|
||||
<foreach item="orderId" collection="array" open="(" separator="," close=")">
|
||||
#{orderId}
|
||||
</foreach>
|
||||
and del_flag = '0' and order_status = 'DRAFT'
|
||||
</update>
|
||||
|
||||
<update id="deleteAmsDisposalOrderItemByOrderIds" parameterType="String">
|
||||
update ams_disposal_order_item set del_flag = '1' where order_id in
|
||||
<foreach item="orderId" collection="array" open="(" separator="," close=")">
|
||||
#{orderId}
|
||||
</foreach>
|
||||
and del_flag = '0'
|
||||
</update>
|
||||
|
||||
<update id="deleteAmsDisposalOrderItemByOrderId" parameterType="Long">
|
||||
update ams_disposal_order_item set del_flag = '1' where order_id = #{orderId} and del_flag = '0'
|
||||
</update>
|
||||
|
||||
<insert id="batchAmsDisposalOrderItem">
|
||||
insert into ams_disposal_order_item( item_id, order_id, disposal_no, asset_id, asset_code, asset_name, category_id, category_code, category_name, spec_model, brand, disposal_reason, disposal_remark, create_by, create_time, update_by, update_time, remark, del_flag) values
|
||||
<foreach item="item" index="index" collection="list" separator=",">
|
||||
( #{item.itemId}, #{item.orderId}, #{item.disposalNo}, #{item.assetId}, #{item.assetCode}, #{item.assetName}, #{item.categoryId}, #{item.categoryCode}, #{item.categoryName}, #{item.specModel}, #{item.brand}, #{item.disposalReason}, #{item.disposalRemark}, #{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime}, #{item.remark}, '0')
|
||||
</foreach>
|
||||
</insert>
|
||||
|
||||
<select id="selectAvailableDisposalAssetList" resultMap="AvailableDisposalAssetResult">
|
||||
select asset.asset_id, asset.asset_code, asset.asset_name, asset.category_id,
|
||||
asset.category_code, asset.category_name, asset.spec_model, asset.brand,
|
||||
asset.asset_status, asset.warehouse_id, asset.warehouse_code, asset.warehouse_name,
|
||||
asset.location_id, asset.location_code, asset.location_name, asset.tag_code
|
||||
from ams_asset asset
|
||||
where asset.del_flag = '0'
|
||||
and asset.asset_status in ('IN_STOCK', 'IN_USE')
|
||||
and not exists (
|
||||
select 1
|
||||
from ams_disposal_order_item item
|
||||
inner join ams_disposal_order o on item.order_id = o.order_id
|
||||
where item.asset_id = asset.asset_id
|
||||
and item.del_flag = '0'
|
||||
and o.del_flag = '0'
|
||||
and o.order_status in ('DRAFT', 'PENDING_CONFIRM')
|
||||
<if test="currentOrderId != null">
|
||||
and o.order_id != #{currentOrderId}
|
||||
</if>
|
||||
)
|
||||
<if test="asset.assetCode != null and asset.assetCode != ''">
|
||||
and asset.asset_code like concat('%', #{asset.assetCode}, '%')
|
||||
</if>
|
||||
<if test="asset.assetName != null and asset.assetName != ''">
|
||||
and asset.asset_name like concat('%', #{asset.assetName}, '%')
|
||||
</if>
|
||||
<if test="asset.categoryName != null and asset.categoryName != ''">
|
||||
and asset.category_name like concat('%', #{asset.categoryName}, '%')
|
||||
</if>
|
||||
order by asset.asset_id
|
||||
</select>
|
||||
|
||||
<select id="countOtherActiveDisposalOrderByAssetId" resultType="int">
|
||||
select count(1)
|
||||
from ams_disposal_order_item item
|
||||
inner join ams_disposal_order o on item.order_id = o.order_id
|
||||
where item.asset_id = #{assetId}
|
||||
and item.del_flag = '0'
|
||||
and o.del_flag = '0'
|
||||
and o.order_status in ('DRAFT', 'PENDING_CONFIRM')
|
||||
<if test="currentOrderId != null">
|
||||
and o.order_id != #{currentOrderId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@ -0,0 +1,228 @@
|
||||
<!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-disposal-add">
|
||||
<h4 class="form-header h4">基本信息</h4>
|
||||
<input type="hidden" name="applicantId" th:value="${applicantId}" />
|
||||
<input type="hidden" name="applyDeptId" th:value="${applyDeptId}" />
|
||||
<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">
|
||||
<input name="applicantName" class="form-control" type="text" th:value="${applicantName}" readonly>
|
||||
</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">
|
||||
<input name="applyDeptName" class="form-control" type="text" th:value="${applyDeptName}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label is-required">处置方式:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="disposalMethod" class="form-control" type="text" placeholder="如:报废、变卖、捐赠等" required max-length="64">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">申请备注:</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea name="remark" class="form-control" placeholder="请输入报废备注信息" max-length="500"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="form-header h4">报废处置明细信息</h4>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<button type="button" class="btn btn-success" onclick="selectAssets()"><i class="fa fa-plus"> 选择资产</i></button>
|
||||
<button type="button" class="btn btn-danger" onclick="removeSelectedAssets()"><i class="fa fa-minus"> 移除资产</i></button>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped" style="padding-top: 10px;">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "asset/disposal";
|
||||
|
||||
$("#form-disposal-add").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
var data = $("#bootstrap-table").bootstrapTable("getData");
|
||||
if (data.length === 0) {
|
||||
$.modal.alertWarning("请选择需要报废的资产明细!");
|
||||
return;
|
||||
}
|
||||
syncDetailRows();
|
||||
$.operate.save(prefix + "/add", $('#form-disposal-add').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
initDetailTable([]);
|
||||
});
|
||||
|
||||
function initDetailTable(data) {
|
||||
$.table.init({
|
||||
data: data,
|
||||
pagination: false,
|
||||
showSearch: false,
|
||||
showRefresh: false,
|
||||
showToggle: false,
|
||||
showColumns: false,
|
||||
sidePagination: "client",
|
||||
columns: [
|
||||
{ checkbox: true },
|
||||
{
|
||||
field: "assetId",
|
||||
title: "资产编码",
|
||||
formatter: function(value, row, index) {
|
||||
return buildAssetCell(row, index);
|
||||
}
|
||||
},
|
||||
{ field: "assetName", title: "资产名称" },
|
||||
{ field: "categoryName", title: "资产类别" },
|
||||
{ field: "specModel", title: "规格型号" },
|
||||
{ field: "brand", title: "品牌" },
|
||||
{
|
||||
field: "disposalReason",
|
||||
title: "报废原因",
|
||||
formatter: function(value, row, index) {
|
||||
return buildInput("amsDisposalOrderItemList[" + index + "].disposalReason", value, 500);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "disposalRemark",
|
||||
title: "处置备注",
|
||||
formatter: function(value, row, index) {
|
||||
return buildInput("amsDisposalOrderItemList[" + index + "].disposalRemark", value, 500);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
align: "center",
|
||||
formatter: function(value, row) {
|
||||
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeAsset(\'' + row.assetId + '\')"><i class="fa fa-remove"></i>删除</a>';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
function selectAssets() {
|
||||
syncDetailRows();
|
||||
$.modal.openOptions({
|
||||
title: "选择待报废资产",
|
||||
url: prefix + "/selectAsset",
|
||||
width: "1200",
|
||||
height: "680",
|
||||
callBack: addSelectedAssets
|
||||
});
|
||||
}
|
||||
|
||||
function addSelectedAssets(index, layero) {
|
||||
var selectedAssets = layero.find("iframe")[0].contentWindow.getSelectedAssets();
|
||||
if (!selectedAssets || selectedAssets.length === 0) {
|
||||
$.modal.alertWarning("请至少选择一条资产记录");
|
||||
return;
|
||||
}
|
||||
syncDetailRows();
|
||||
var existing = {};
|
||||
$.each($("#bootstrap-table").bootstrapTable("getData"), function(i, row) {
|
||||
existing[String(row.assetId)] = true;
|
||||
});
|
||||
$.each(selectedAssets, function(i, asset) {
|
||||
if (!existing[String(asset.assetId)]) {
|
||||
$("#bootstrap-table").bootstrapTable("insertRow", {
|
||||
index: $("#bootstrap-table").bootstrapTable("getData").length,
|
||||
row: buildDisposalItem(asset)
|
||||
});
|
||||
existing[String(asset.assetId)] = true;
|
||||
}
|
||||
});
|
||||
$.modal.close(index);
|
||||
}
|
||||
|
||||
function buildDisposalItem(asset) {
|
||||
return {
|
||||
assetId: asset.assetId,
|
||||
assetCode: asset.assetCode,
|
||||
assetName: asset.assetName,
|
||||
categoryName: asset.categoryName,
|
||||
specModel: asset.specModel,
|
||||
brand: asset.brand,
|
||||
disposalReason: "",
|
||||
disposalRemark: ""
|
||||
};
|
||||
}
|
||||
|
||||
function removeSelectedAssets() {
|
||||
var rows = $("#bootstrap-table").bootstrapTable("getSelections");
|
||||
if (rows.length === 0) {
|
||||
$.modal.alertWarning("请至少选择一条记录");
|
||||
return;
|
||||
}
|
||||
syncDetailRows();
|
||||
$("#bootstrap-table").bootstrapTable("remove", {
|
||||
field: "assetId",
|
||||
values: $.map(rows, function(row) { return row.assetId; })
|
||||
});
|
||||
}
|
||||
|
||||
function removeAsset(assetId) {
|
||||
syncDetailRows();
|
||||
$("#bootstrap-table").bootstrapTable("remove", { field: "assetId", values: [assetId] });
|
||||
}
|
||||
|
||||
function syncDetailRows() {
|
||||
var rows = $("#bootstrap-table").bootstrapTable("getData");
|
||||
$.each(rows, function(index, row) {
|
||||
var tr = $("#bootstrap-table tbody tr[data-index='" + index + "']");
|
||||
row.disposalReason = tr.find("[name$='.disposalReason']").val() || "";
|
||||
row.disposalRemark = tr.find("[name$='.disposalRemark']").val() || "";
|
||||
});
|
||||
}
|
||||
|
||||
function buildAssetCell(row, index) {
|
||||
var hidden = $("<input>").attr({
|
||||
type: "hidden",
|
||||
name: "amsDisposalOrderItemList[" + index + "].assetId",
|
||||
value: row.assetId
|
||||
}).prop("outerHTML");
|
||||
return hidden + $("<span>").text(row.assetCode).prop("outerHTML");
|
||||
}
|
||||
|
||||
function buildInput(name, value, maxLength) {
|
||||
return $("<input>").addClass("form-control").attr({
|
||||
type: "text",
|
||||
name: name,
|
||||
maxlength: maxLength
|
||||
}).val(value || "").prop("outerHTML");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,207 @@
|
||||
<!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="disposalNo"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>申请人:</label>
|
||||
<input type="text" name="applicantName"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>申请部门:</label>
|
||||
<input type="text" name="applyDeptName"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>处置方式:</label>
|
||||
<input type="text" name="disposalMethod"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>资产编码:</label>
|
||||
<input type="text" name="assetCode"/>
|
||||
</li>
|
||||
<li class="select-time">
|
||||
<label>处置时间:</label>
|
||||
<input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginDisposalTime]"/>
|
||||
<span>-</span>
|
||||
<input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endDisposalTime]"/>
|
||||
</li>
|
||||
<li>
|
||||
<label>单据状态:</label>
|
||||
<select name="orderStatus" th:with="type=${@dict.getType('ams_disposal_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> 搜索</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i> 重置</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:disposal:add">
|
||||
<i class="fa fa-plus"></i> 新增申请
|
||||
</a>
|
||||
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="asset:disposal: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:disposal:edit')}]];
|
||||
var removeFlag = [[${@permission.hasPermi('asset:disposal:remove')}]];
|
||||
var submitFlag = [[${@permission.hasPermi('asset:disposal:submit')}]];
|
||||
var confirmFlag = [[${@permission.hasPermi('asset:disposal:confirm')}]];
|
||||
var rejectFlag = [[${@permission.hasPermi('asset:disposal:reject')}]];
|
||||
var orderStatusDatas = [[${@dict.getType('ams_disposal_status')}]];
|
||||
var prefix = ctx + "asset/disposal";
|
||||
|
||||
$(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: 'orderId',
|
||||
title: '单据ID',
|
||||
visible: false
|
||||
},
|
||||
{
|
||||
field: 'disposalNo',
|
||||
title: '报废单号'
|
||||
},
|
||||
{
|
||||
field: 'applicantName',
|
||||
title: '申请人'
|
||||
},
|
||||
{
|
||||
field: 'applyDeptName',
|
||||
title: '申请部门'
|
||||
},
|
||||
{
|
||||
field: 'disposalMethod',
|
||||
title: '处置方式'
|
||||
},
|
||||
{
|
||||
field: 'createTime',
|
||||
title: '申请时间'
|
||||
},
|
||||
{
|
||||
field: 'confirmUserName',
|
||||
title: '确认人'
|
||||
},
|
||||
{
|
||||
field: 'confirmTime',
|
||||
title: '确认时间'
|
||||
},
|
||||
{
|
||||
field: 'orderStatus',
|
||||
title: '单据状态',
|
||||
formatter: function(value, row, index) {
|
||||
return $.table.selectDictLabel(orderStatusDatas, value);
|
||||
}
|
||||
},
|
||||
{
|
||||
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.orderId + '\')"><i class="fa fa-eye"></i>查看</a> ');
|
||||
|
||||
// 草稿状态允许编辑、提交、删除;已驳回是终态,只允许查看。
|
||||
if (row.orderStatus === 'DRAFT') {
|
||||
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.orderId + '\')"><i class="fa fa-edit"></i>编辑</a> ');
|
||||
actions.push('<a class="btn btn-warning btn-xs ' + submitFlag + '" href="javascript:void(0)" onclick="submitOrder(\'' + row.orderId + '\')"><i class="fa fa-send"></i>提交</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderId + '\')"><i class="fa fa-remove"></i>删除</a> ');
|
||||
}
|
||||
|
||||
// 待确认状态允许确认报废和驳回
|
||||
if (row.orderStatus === 'PENDING_CONFIRM') {
|
||||
actions.push('<a class="btn btn-success btn-xs ' + confirmFlag + '" href="javascript:void(0)" onclick="confirmOrder(\'' + row.orderId + '\')"><i class="fa fa-check"></i>确认报废</a> ');
|
||||
actions.push('<a class="btn btn-danger btn-xs ' + rejectFlag + '" href="javascript:void(0)" onclick="rejectOrder(\'' + row.orderId + '\')"><i class="fa fa-reply"></i>驳回</a> ');
|
||||
}
|
||||
return actions.join('');
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
|
||||
function submitOrder(orderId) {
|
||||
$.modal.confirm("确认要提交该报废申请吗?", function() {
|
||||
$.post(prefix + "/submit/" + orderId, function(result) {
|
||||
if (result.code == web_status.SUCCESS) {
|
||||
$.modal.msgSuccess(result.msg);
|
||||
$.table.refresh();
|
||||
} else {
|
||||
$.modal.alertError(result.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function confirmOrder(orderId) {
|
||||
$.modal.confirm("确认要同意并执行此报废处置吗?此操作将更改对应资产为已报废状态,并且不可回滚!", function() {
|
||||
$.post(prefix + "/confirm/" + orderId, function(result) {
|
||||
if (result.code == web_status.SUCCESS) {
|
||||
$.modal.msgSuccess(result.msg);
|
||||
$.table.refresh();
|
||||
} else {
|
||||
$.modal.alertError(result.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
function rejectOrder(orderId) {
|
||||
$.modal.openPrompt("驳回原因", "请输入驳回原因", function(index, layero) {
|
||||
var rejectReason = layero.find(".layui-layer-input").val();
|
||||
if ($.common.isEmpty(rejectReason)) {
|
||||
$.modal.msgWarning("驳回原因不能为空");
|
||||
return false;
|
||||
}
|
||||
if (rejectReason.length > 500) {
|
||||
$.modal.msgWarning("驳回原因长度不能超过500个字符");
|
||||
return false;
|
||||
}
|
||||
$.post(prefix + "/reject/" + orderId, { rejectReason: rejectReason }, function(result) {
|
||||
if (result.code == web_status.SUCCESS) {
|
||||
$.modal.msgSuccess(result.msg);
|
||||
layer.close(index);
|
||||
$.table.refresh();
|
||||
} else {
|
||||
$.modal.alertError(result.msg);
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,250 @@
|
||||
<!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-disposal-edit" th:object="${amsDisposalOrder}">
|
||||
<h4 class="form-header h4">基本信息</h4>
|
||||
<input name="orderId" th:field="*{orderId}" type="hidden" />
|
||||
<input type="hidden" name="applicantId" th:field="*{applicantId}" />
|
||||
<input type="hidden" name="applyDeptId" th:field="*{applyDeptId}" />
|
||||
<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">
|
||||
<input name="disposalNo" th:field="*{disposalNo}" class="form-control" type="text" readonly>
|
||||
</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">
|
||||
<select name="orderStatus" class="form-control" th:with="type=${@dict.getType('ams_disposal_status')}" th:field="*{orderStatus}" disabled>
|
||||
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
|
||||
</select>
|
||||
</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">
|
||||
<input name="applicantName" class="form-control" type="text" th:field="*{applicantName}" readonly>
|
||||
</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">
|
||||
<input name="applyDeptName" class="form-control" type="text" th:field="*{applyDeptName}" readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-6">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-4 control-label is-required">处置方式:</label>
|
||||
<div class="col-sm-8">
|
||||
<input name="disposalMethod" th:field="*{disposalMethod}" class="form-control" type="text" placeholder="如:报废、变卖、捐赠等" required max-length="64">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">申请备注:</label>
|
||||
<div class="col-sm-10">
|
||||
<textarea name="remark" class="form-control" placeholder="请输入报废备注信息" max-length="500">[[*{remark}]]</textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="form-header h4">报废处置明细信息</h4>
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="btn-group-sm" id="toolbar" role="group">
|
||||
<button type="button" class="btn btn-success" onclick="selectAssets()"><i class="fa fa-plus"> 选择资产</i></button>
|
||||
<button type="button" class="btn btn-danger" onclick="removeSelectedAssets()"><i class="fa fa-minus"> 移除资产</i></button>
|
||||
</div>
|
||||
<div class="col-sm-12 select-table table-striped" style="padding-top: 10px;">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
var prefix = ctx + "asset/disposal";
|
||||
|
||||
$("#form-disposal-edit").validate({
|
||||
focusCleanup: true
|
||||
});
|
||||
|
||||
function submitHandler() {
|
||||
if ($.validate.form()) {
|
||||
var data = $("#bootstrap-table").bootstrapTable("getData");
|
||||
if (data.length === 0) {
|
||||
$.modal.alertWarning("请选择需要报废的资产明细!");
|
||||
return;
|
||||
}
|
||||
syncDetailRows();
|
||||
$.operate.save(prefix + "/edit", $('#form-disposal-edit').serialize());
|
||||
}
|
||||
}
|
||||
|
||||
$(function() {
|
||||
var data = [[${amsDisposalOrder.amsDisposalOrderItemList}]];
|
||||
initDetailTable(data);
|
||||
});
|
||||
|
||||
function initDetailTable(data) {
|
||||
$.table.init({
|
||||
data: data,
|
||||
pagination: false,
|
||||
showSearch: false,
|
||||
showRefresh: false,
|
||||
showToggle: false,
|
||||
showColumns: false,
|
||||
sidePagination: "client",
|
||||
columns: [
|
||||
{ checkbox: true },
|
||||
{
|
||||
field: "assetId",
|
||||
title: "资产编码",
|
||||
formatter: function(value, row, index) {
|
||||
return buildAssetCell(row, index);
|
||||
}
|
||||
},
|
||||
{ field: "assetName", title: "资产名称" },
|
||||
{ field: "categoryName", title: "资产类别" },
|
||||
{ field: "specModel", title: "规格型号" },
|
||||
{ field: "brand", title: "品牌" },
|
||||
{
|
||||
field: "disposalReason",
|
||||
title: "报废原因",
|
||||
formatter: function(value, row, index) {
|
||||
return buildInput("amsDisposalOrderItemList[" + index + "].disposalReason", value, 500);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: "disposalRemark",
|
||||
title: "处置备注",
|
||||
formatter: function(value, row, index) {
|
||||
return buildInput("amsDisposalOrderItemList[" + index + "].disposalRemark", value, 500);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: "操作",
|
||||
align: "center",
|
||||
formatter: function(value, row) {
|
||||
return '<a class="btn btn-danger btn-xs" href="javascript:void(0)" onclick="removeAsset(\'' + row.assetId + '\')"><i class="fa fa-remove"></i>删除</a>';
|
||||
}
|
||||
}
|
||||
]
|
||||
});
|
||||
}
|
||||
|
||||
function selectAssets() {
|
||||
syncDetailRows();
|
||||
$.modal.openOptions({
|
||||
title: "选择待报废资产",
|
||||
url: prefix + "/selectAsset?orderId=" + $("[name='orderId']").val(),
|
||||
width: "1200",
|
||||
height: "680",
|
||||
callBack: addSelectedAssets
|
||||
});
|
||||
}
|
||||
|
||||
function addSelectedAssets(index, layero) {
|
||||
var selectedAssets = layero.find("iframe")[0].contentWindow.getSelectedAssets();
|
||||
if (!selectedAssets || selectedAssets.length === 0) {
|
||||
$.modal.alertWarning("请至少选择一条资产记录");
|
||||
return;
|
||||
}
|
||||
syncDetailRows();
|
||||
var existing = {};
|
||||
$.each($("#bootstrap-table").bootstrapTable("getData"), function(i, row) {
|
||||
existing[String(row.assetId)] = true;
|
||||
});
|
||||
$.each(selectedAssets, function(i, asset) {
|
||||
if (!existing[String(asset.assetId)]) {
|
||||
$("#bootstrap-table").bootstrapTable("insertRow", {
|
||||
index: $("#bootstrap-table").bootstrapTable("getData").length,
|
||||
row: buildDisposalItem(asset)
|
||||
});
|
||||
existing[String(asset.assetId)] = true;
|
||||
}
|
||||
});
|
||||
$.modal.close(index);
|
||||
}
|
||||
|
||||
function buildDisposalItem(asset) {
|
||||
return {
|
||||
assetId: asset.assetId,
|
||||
assetCode: asset.assetCode,
|
||||
assetName: asset.assetName,
|
||||
categoryName: asset.categoryName,
|
||||
specModel: asset.specModel,
|
||||
brand: asset.brand,
|
||||
disposalReason: "",
|
||||
disposalRemark: ""
|
||||
};
|
||||
}
|
||||
|
||||
function removeSelectedAssets() {
|
||||
var rows = $("#bootstrap-table").bootstrapTable("getSelections");
|
||||
if (rows.length === 0) {
|
||||
$.modal.alertWarning("请至少选择一条记录");
|
||||
return;
|
||||
}
|
||||
syncDetailRows();
|
||||
$("#bootstrap-table").bootstrapTable("remove", {
|
||||
field: "assetId",
|
||||
values: $.map(rows, function(row) { return row.assetId; })
|
||||
});
|
||||
}
|
||||
|
||||
function removeAsset(assetId) {
|
||||
syncDetailRows();
|
||||
$("#bootstrap-table").bootstrapTable("remove", { field: "assetId", values: [assetId] });
|
||||
}
|
||||
|
||||
function syncDetailRows() {
|
||||
var rows = $("#bootstrap-table").bootstrapTable("getData");
|
||||
$.each(rows, function(index, row) {
|
||||
var tr = $("#bootstrap-table tbody tr[data-index='" + index + "']");
|
||||
row.disposalReason = tr.find("[name$='.disposalReason']").val() || "";
|
||||
row.disposalRemark = tr.find("[name$='.disposalRemark']").val() || "";
|
||||
});
|
||||
}
|
||||
|
||||
function buildAssetCell(row, index) {
|
||||
var hidden = $("<input>").attr({
|
||||
type: "hidden",
|
||||
name: "amsDisposalOrderItemList[" + index + "].assetId",
|
||||
value: row.assetId
|
||||
}).prop("outerHTML");
|
||||
return hidden + $("<span>").text(row.assetCode).prop("outerHTML");
|
||||
}
|
||||
|
||||
function buildInput(name, value, maxLength) {
|
||||
return $("<input>").addClass("form-control").attr({
|
||||
type: "text",
|
||||
name: name,
|
||||
maxlength: maxLength
|
||||
}).val(value || "").prop("outerHTML");
|
||||
}
|
||||
</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 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="assetCode"></li>
|
||||
<li><label>资产名称:</label><input type="text" name="assetName"></li>
|
||||
<li><label>资产类别:</label><input type="text" name="categoryName"></li>
|
||||
<li>
|
||||
<a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()">
|
||||
<i class="fa fa-search"></i> 搜索
|
||||
</a>
|
||||
<a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()">
|
||||
<i class="fa fa-refresh"></i> 重置
|
||||
</a>
|
||||
</li>
|
||||
</ul>
|
||||
</div>
|
||||
</form>
|
||||
</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 prefix = ctx + "asset/disposal";
|
||||
var orderId = [[${orderId}]];
|
||||
|
||||
$(function() {
|
||||
var url = prefix + "/availableAssetList";
|
||||
if (orderId) {
|
||||
url += "?orderId=" + orderId;
|
||||
}
|
||||
$.table.init({
|
||||
url: url,
|
||||
showSearch: false,
|
||||
showRefresh: true,
|
||||
showToggle: false,
|
||||
showColumns: false,
|
||||
modalName: "待报废资产",
|
||||
columns: [
|
||||
{ checkbox: true },
|
||||
{ field: "assetCode", title: "资产编码" },
|
||||
{ field: "assetName", title: "资产名称" },
|
||||
{ field: "categoryName", title: "资产类别" },
|
||||
{ field: "specModel", title: "规格型号" },
|
||||
{ field: "brand", title: "品牌" },
|
||||
{ field: "warehouseName", title: "当前仓库" },
|
||||
{ field: "locationName", title: "当前位置" }
|
||||
]
|
||||
});
|
||||
});
|
||||
|
||||
function getSelectedAssets() {
|
||||
return $("#bootstrap-table").bootstrapTable("getSelections");
|
||||
}
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
@ -0,0 +1,175 @@
|
||||
<!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" th:object="${amsDisposalOrder}">
|
||||
<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="*{disposalNo}"></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="*{@dict.getLabel('ams_disposal_status', orderStatus)}"></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="*{applicantName}"></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="*{applyDeptName}"></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="*{disposalMethod}"></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="*{#dates.format(createTime, 'yyyy-MM-dd HH:mm:ss')}"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="form-header h4" th:if="*{confirmUserId != null}">确认信息</h4>
|
||||
<div class="row" th:if="*{confirmUserId != null}">
|
||||
<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="*{confirmUserName}"></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="*{#dates.format(confirmTime, 'yyyy-MM-dd HH:mm:ss')}"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="form-header h4" th:if="*{rejectReason != null and rejectReason != ''}">驳回信息</h4>
|
||||
<div class="row" th:if="*{rejectReason != null and rejectReason != ''}">
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">驳回原因:</label>
|
||||
<div class="col-sm-10">
|
||||
<p class="form-control-plaintext text-danger" th:text="*{rejectReason}"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="form-group">
|
||||
<label class="col-sm-2 control-label">申请备注:</label>
|
||||
<div class="col-sm-10">
|
||||
<p class="form-control-plaintext" th:text="*{remark}"></p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<h4 class="form-header h4">报废处置明细信息</h4>
|
||||
<div class="row">
|
||||
<div class="col-sm-12 select-table table-striped">
|
||||
<table id="bootstrap-table"></table>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
<th:block th:include="include :: footer" />
|
||||
<script th:inline="javascript">
|
||||
$(function() {
|
||||
var data = [[${amsDisposalOrder.amsDisposalOrderItemList}]];
|
||||
var options = {
|
||||
data: data,
|
||||
pagination: false,
|
||||
showSearch: false,
|
||||
showRefresh: false,
|
||||
showToggle: false,
|
||||
showColumns: false,
|
||||
sidePagination: "client",
|
||||
columns: [
|
||||
{
|
||||
field: 'index',
|
||||
title: '序号',
|
||||
formatter: function (value, row, index) {
|
||||
return index + 1;
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'assetCode',
|
||||
title: '资产编码'
|
||||
},
|
||||
{
|
||||
field: 'assetName',
|
||||
title: '资产名称'
|
||||
},
|
||||
{
|
||||
field: 'categoryName',
|
||||
title: '资产类别'
|
||||
},
|
||||
{
|
||||
field: 'specModel',
|
||||
title: '规格型号'
|
||||
},
|
||||
{
|
||||
field: 'brand',
|
||||
title: '品牌'
|
||||
},
|
||||
{
|
||||
field: 'disposalReason',
|
||||
title: '报废原因',
|
||||
formatter: function(value) {
|
||||
return value || "-";
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'disposalRemark',
|
||||
title: '处置备注',
|
||||
formatter: function(value) {
|
||||
return value || "-";
|
||||
}
|
||||
}]
|
||||
};
|
||||
$.table.init(options);
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Reference in New Issue