Browse Source

[add]:bom基础类

erp、
youjianchi 10 months ago
parent
commit
faf0dc3adb
  1. 151
      ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java
  2. 111
      ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java
  3. 77
      ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java
  4. 75
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java
  5. 133
      ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java
  6. 104
      ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml
  7. 1
      ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml
  8. 170
      ruoyi-admin/src/main/resources/templates/erp/bom/add.html
  9. 137
      ruoyi-admin/src/main/resources/templates/erp/bom/bom.html
  10. 62
      ruoyi-admin/src/main/resources/templates/erp/bom/edit.html

151
ruoyi-admin/src/main/java/com/ruoyi/erp/controller/ErpBomController.java

@ -0,0 +1,151 @@
package com.ruoyi.erp.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.erp.domain.ErpBom;
import com.ruoyi.erp.service.IErpBomService;
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;
/**
* bomController
*
* @author ruoyi
* @date 2023-11-19
*/
@Controller
@RequestMapping("/erp/bom")
public class ErpBomController extends BaseController
{
private String prefix = "erp/bom";
@Autowired
private IErpBomService erpBomService;
@RequiresPermissions("erp:bom:view")
@GetMapping()
public String bom()
{
return prefix + "/bom";
}
/**
* 查询bom列表
*/
@RequiresPermissions("erp:bom:list")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(ErpBom erpBom)
{
startPage();
List<ErpBom> list = erpBomService.selectErpBomList(erpBom);
return getDataTable(list);
}
/**
* 导出bom列表
*/
@RequiresPermissions("erp:bom:export")
@Log(title = "bom", businessType = BusinessType.EXPORT)
@PostMapping("/export")
@ResponseBody
public AjaxResult export(ErpBom erpBom)
{
List<ErpBom> list = erpBomService.selectErpBomList(erpBom);
ExcelUtil<ErpBom> util = new ExcelUtil<ErpBom>(ErpBom.class);
return util.exportExcel(list, "bom数据");
}
/**
* 新增bom
*/
@GetMapping("/add")
public String add()
{
return prefix + "/add";
}
/**
* 新增保存bom
*/
@RequiresPermissions("erp:bom:add")
@Log(title = "bom", businessType = BusinessType.INSERT)
@PostMapping("/add")
@ResponseBody
public AjaxResult addSave(ErpBom erpBom)
{
return toAjax(erpBomService.insertErpBom(erpBom));
}
/**
* 修改bom
*/
@GetMapping("/edit/{id}")
public String edit(@PathVariable("id") Long id, ModelMap mmap)
{
ErpBom erpBom = erpBomService.selectErpBomById(id);
mmap.put("erpBom", erpBom);
return prefix + "/edit";
}
/**
* 修改保存bom
*/
@RequiresPermissions("erp:bom:edit")
@Log(title = "bom", businessType = BusinessType.UPDATE)
@PostMapping("/edit")
@ResponseBody
public AjaxResult editSave(ErpBom erpBom)
{
return toAjax(erpBomService.updateErpBom(erpBom));
}
/**
* 删除bom
*/
@RequiresPermissions("erp:bom:remove")
@Log(title = "bom", businessType = BusinessType.DELETE)
@PostMapping( "/remove")
@ResponseBody
public AjaxResult remove(String ids)
{
return toAjax(erpBomService.deleteErpBomByIds(ids));
}
/**
* 作废bom
*/
@RequiresPermissions("erp:bom:cancel")
@Log(title = "bom", businessType = BusinessType.CANCEL)
@GetMapping( "/cancel/{id}")
@ResponseBody
public AjaxResult cancel(@PathVariable("id") Long id){
return toAjax(erpBomService.cancelErpBomById(id));
}
/**
* 恢复bom
*/
@RequiresPermissions("erp:bom:restore")
@Log(title = "bom", businessType = BusinessType.RESTORE)
@GetMapping( "/restore/{id}")
@ResponseBody
public AjaxResult restore(@PathVariable("id")Long id)
{
return toAjax(erpBomService.restoreErpBomById(id));
}
}

111
ruoyi-admin/src/main/java/com/ruoyi/erp/domain/ErpBom.java

@ -0,0 +1,111 @@
package com.ruoyi.erp.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;
/**
* bom对象 erp_bom
*
* @author ruoyi
* @date 2023-11-19
*/
public class ErpBom extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 主键ID */
private Long id;
/** 删除标志(0代表存在 1代表删除) */
private String delFlag;
/** bom号 */
@Excel(name = "bom号")
private String bomNo;
/** 料号 */
@Excel(name = "料号")
private String materialNo;
/** 审核状态 */
@Excel(name = "审核状态")
private String auditStatus;
/** 使用状态 */
@Excel(name = "使用状态")
private String useStatus;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setDelFlag(String delFlag)
{
this.delFlag = delFlag;
}
public String getDelFlag()
{
return delFlag;
}
public void setBomNo(String bomNo)
{
this.bomNo = bomNo;
}
public String getBomNo()
{
return bomNo;
}
public void setMaterialNo(String materialNo)
{
this.materialNo = materialNo;
}
public String getMaterialNo()
{
return materialNo;
}
public void setAuditStatus(String auditStatus)
{
this.auditStatus = auditStatus;
}
public String getAuditStatus()
{
return auditStatus;
}
public void setUseStatus(String useStatus)
{
this.useStatus = useStatus;
}
public String getUseStatus()
{
return useStatus;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("delFlag", getDelFlag())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("bomNo", getBomNo())
.append("materialNo", getMaterialNo())
.append("auditStatus", getAuditStatus())
.append("useStatus", getUseStatus())
.toString();
}
}

77
ruoyi-admin/src/main/java/com/ruoyi/erp/mapper/ErpBomMapper.java

@ -0,0 +1,77 @@
package com.ruoyi.erp.mapper;
import java.util.List;
import com.ruoyi.erp.domain.ErpBom;
/**
* bomMapper接口
*
* @author ruoyi
* @date 2023-11-19
*/
public interface ErpBomMapper
{
/**
* 查询bom
*
* @param id bomID
* @return bom
*/
public ErpBom selectErpBomById(Long id);
/**
* 查询bom列表
*
* @param erpBom bom
* @return bom集合
*/
public List<ErpBom> selectErpBomList(ErpBom erpBom);
/**
* 新增bom
*
* @param erpBom bom
* @return 结果
*/
public int insertErpBom(ErpBom erpBom);
/**
* 修改bom
*
* @param erpBom bom
* @return 结果
*/
public int updateErpBom(ErpBom erpBom);
/**
* 删除bom
*
* @param id bomID
* @return 结果
*/
public int deleteErpBomById(Long id);
/**
* 批量删除bom
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteErpBomByIds(String[] ids);
/**
* 作废bom
*
* @param id bomID
* @return 结果
*/
public int cancelErpBomById(Long id);
/**
* 恢复bom
*
* @param id bomID
* @return 结果
*/
public int restoreErpBomById(Long id);
}

75
ruoyi-admin/src/main/java/com/ruoyi/erp/service/IErpBomService.java

@ -0,0 +1,75 @@
package com.ruoyi.erp.service;
import java.util.List;
import com.ruoyi.erp.domain.ErpBom;
/**
* bomService接口
*
* @author ruoyi
* @date 2023-11-19
*/
public interface IErpBomService
{
/**
* 查询bom
*
* @param id bomID
* @return bom
*/
public ErpBom selectErpBomById(Long id);
/**
* 查询bom列表
*
* @param erpBom bom
* @return bom集合
*/
public List<ErpBom> selectErpBomList(ErpBom erpBom);
/**
* 新增bom
*
* @param erpBom bom
* @return 结果
*/
public int insertErpBom(ErpBom erpBom);
/**
* 修改bom
*
* @param erpBom bom
* @return 结果
*/
public int updateErpBom(ErpBom erpBom);
/**
* 批量删除bom
*
* @param ids 需要删除的数据ID
* @return 结果
*/
public int deleteErpBomByIds(String ids);
/**
* 删除bom信息
*
* @param id bomID
* @return 结果
*/
public int deleteErpBomById(Long id);
/**
* 作废bom
* @param id bomID
* @return
*/
int cancelErpBomById(Long id);
/**
* 恢复bom
* @param id bomID
* @return
*/
int restoreErpBomById(Long id);
}

133
ruoyi-admin/src/main/java/com/ruoyi/erp/service/impl/ErpBomServiceImpl.java

@ -0,0 +1,133 @@
package com.ruoyi.erp.service.impl;
import java.util.List;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.common.utils.DateUtils;
import com.ruoyi.common.utils.ShiroUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.erp.mapper.ErpBomMapper;
import com.ruoyi.erp.domain.ErpBom;
import com.ruoyi.erp.service.IErpBomService;
import com.ruoyi.common.core.text.Convert;
/**
* bomService业务层处理
*
* @author ruoyi
* @date 2023-11-19
*/
@Service
public class ErpBomServiceImpl implements IErpBomService
{
@Autowired
private ErpBomMapper erpBomMapper;
@Autowired
private RedisCache redisCache;
/**
* 查询bom
*
* @param id bomID
* @return bom
*/
@Override
public ErpBom selectErpBomById(Long id)
{
return erpBomMapper.selectErpBomById(id);
}
/**
* 查询bom列表
*
* @param erpBom bom
* @return bom
*/
@Override
public List<ErpBom> selectErpBomList(ErpBom erpBom)
{
return erpBomMapper.selectErpBomList(erpBom);
}
/**
* 新增bom
*
* @param erpBom bom
* @return 结果
*/
@Override
public int insertErpBom(ErpBom erpBom)
{
String billNo = redisCache.generateBillNo("BOM");
erpBom.setBomNo(billNo);
String loginName = ShiroUtils.getLoginName();
erpBom.setCreateBy(loginName);
erpBom.setCreateTime(DateUtils.getNowDate());
return erpBomMapper.insertErpBom(erpBom);
}
/**
* 修改bom
*
* @param erpBom bom
* @return 结果
*/
@Override
public int updateErpBom(ErpBom erpBom)
{
String loginName = ShiroUtils.getLoginName();
erpBom.setUpdateBy(loginName);
erpBom.setUpdateTime(DateUtils.getNowDate());
return erpBomMapper.updateErpBom(erpBom);
}
/**
* 删除bom对象
*
* @param ids 需要删除的数据ID
* @return 结果
*/
@Override
public int deleteErpBomByIds(String ids)
{
return erpBomMapper.deleteErpBomByIds(Convert.toStrArray(ids));
}
/**
* 删除bom信息
*
* @param id bomID
* @return 结果
*/
@Override
public int deleteErpBomById(Long id)
{
return erpBomMapper.deleteErpBomById(id);
}
/**
* 作废bom
*
* @param id bomID
* @return 结果
*/
@Override
public int cancelErpBomById(Long id)
{
return erpBomMapper.cancelErpBomById(id);
}
/**
* 恢复bom信息
*
* @param id bomID
* @return 结果
*/
@Override
public int restoreErpBomById(Long id)
{
return erpBomMapper.restoreErpBomById(id);
}
}

104
ruoyi-admin/src/main/resources/mapper/erp/ErpBomMapper.xml

@ -0,0 +1,104 @@
<?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.erp.mapper.ErpBomMapper">
<resultMap type="ErpBom" id="ErpBomResult">
<result property="id" column="id" />
<result property="delFlag" column="del_flag" />
<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="bomNo" column="bom_no" />
<result property="materialNo" column="material_no" />
<result property="auditStatus" column="audit_status" />
<result property="useStatus" column="use_status" />
</resultMap>
<sql id="selectErpBomVo">
select id, del_flag, create_by, create_time, update_by, update_time, remark, bom_no, material_no, audit_status, use_status from erp_bom
</sql>
<select id="selectErpBomList" parameterType="ErpBom" resultMap="ErpBomResult">
<include refid="selectErpBomVo"/>
<where>
<if test="bomNo != null and bomNo != ''"> and bom_no = #{bomNo}</if>
<if test="materialNo != null and materialNo != ''"> and material_no = #{materialNo}</if>
<if test="auditStatus != null and auditStatus != ''"> and audit_status = #{auditStatus}</if>
<if test="useStatus != null and useStatus != ''"> and use_status = #{useStatus}</if>
</where>
</select>
<select id="selectErpBomById" parameterType="Long" resultMap="ErpBomResult">
<include refid="selectErpBomVo"/>
where id = #{id}
</select>
<insert id="insertErpBom" parameterType="ErpBom" useGeneratedKeys="true" keyProperty="id">
insert into erp_bom
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="delFlag != null">del_flag,</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="bomNo != null">bom_no,</if>
<if test="materialNo != null">material_no,</if>
<if test="auditStatus != null">audit_status,</if>
<if test="useStatus != null">use_status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="delFlag != null">#{delFlag},</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="bomNo != null">#{bomNo},</if>
<if test="materialNo != null">#{materialNo},</if>
<if test="auditStatus != null">#{auditStatus},</if>
<if test="useStatus != null">#{useStatus},</if>
</trim>
</insert>
<update id="updateErpBom" parameterType="ErpBom">
update erp_bom
<trim prefix="SET" suffixOverrides=",">
<if test="delFlag != null">del_flag = #{delFlag},</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="bomNo != null">bom_no = #{bomNo},</if>
<if test="materialNo != null">material_no = #{materialNo},</if>
<if test="auditStatus != null">audit_status = #{auditStatus},</if>
<if test="useStatus != null">use_status = #{useStatus},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteErpBomById" parameterType="Long">
delete from erp_bom where id = #{id}
</delete>
<delete id="deleteErpBomByIds" parameterType="String">
delete from erp_bom where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<update id="cancelErpBomById" parameterType="Long">
update erp_bom set del_flag = '1' where id = #{id}
</update>
<update id="restoreErpBomById" parameterType="Long">
update erp_bom set del_flag = '0' where id = #{id}
</update>
</mapper>

1
ruoyi-admin/src/main/resources/mapper/erp/ErpMaterialMapper.xml

@ -52,6 +52,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<where>
<if test="createBy != null and createBy != ''"> and erp.create_by = #{createBy}</if>
<if test="params.beginCreateTime != null and params.beginCreateTime != '' and params.endCreateTime != null and params.endCreateTime != ''"> and erp.create_time between #{params.beginCreateTime} and #{params.endCreateTime}</if>
<if test="params.materialNo != null and params.materialNo != ''"> and erp.material_no like concat('%', #{params.materialNo}, '%')</if>
<if test="materialNo != null and materialNo != ''"> and erp.material_no = #{materialNo}</if>
<if test="materialName != null and materialName != ''"> and erp.material_name like concat('%', #{materialName}, '%')</if>
<if test="auditStatus != null and auditStatus != ''"> and erp.audit_status = #{auditStatus}</if>

170
ruoyi-admin/src/main/resources/templates/erp/bom/add.html

@ -0,0 +1,170 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('新增bom')" />
<th:block th:include="include :: select2-css" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-bom-add">
<div class="form-group">
<label class="col-sm-3 control-label is-required">料号:</label>
<div class="col-sm-8">
<!--<div class="input-group">
<input name="materialNo" onclick="selMaterialTb()" id="materialNo" type="text" placeholder="请选择料号" class="form-control" required>
<span class="input-group-addon"><i class="fa fa-search"></i></span>
</div>-->
<select class="form-control" id="materialNo" name="materialNo" required>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料名称:</label>
<div class="col-sm-8">
<input name="materialName" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">物料类型:</label>
<div class="col-sm-8">
<select id="selectMaterialType" class="form-control m-b select2-multiple" th:with="childList=${@category.getChildByCode('materialType')}" disabled>
<optgroup>
<option value=""></option>
</optgroup>
<optgroup th:each="child: ${childList}" th:label="${child.name}">
<option th:each="childSon: ${child.children}" th:value="${childSon.code}" th:text="${#strings.concat(child.name,'-',childSon.name)}"></option>
</optgroup>
</select>
</div>
<input type="text" id="materialType" name="materialType" hidden />
</div>
<div class="form-group">
<label class="col-sm-3 control-label">加工方式:</label>
<div class="col-sm-8">
<select name="processMethod" class="form-control m-b" th:with="type=${@dict.getType('processMethod')}" disabled>
<option value=""></option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">单位:</label>
<div class="col-sm-8">
<select name="unit" class="form-control m-b" th:with="type=${@dict.getType('sys_unit_class')}" disabled>
<option value=""></option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">品牌:</label>
<div class="col-sm-8">
<input name="brand" class="form-control" type="text" disabled>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">描述:</label>
<div class="col-sm-8">
<textarea name="describe" class="form-control" disabled></textarea>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<th:block th:include="include :: select2-js" />
<script th:inline="javascript">
var prefix = ctx + "erp/bom"
$(function(){
$("#materialNo").select2({
theme: "bootstrap",
allowClear: true,
placeholder: "请选择一个料号",
ajax:{
type: "post",
url:ctx+"erp/material/list",
dataType:"json",
delay:250,
data:function(params){
var searchVal = params.term;
var obj = {
params:{
materialNo: searchVal
}
};
return obj;
/*return {
materialNo: params.term,
// page: params.page || 1
};*/
},
cache:true,
processResults: function (res, params) {
var resultList = res.rows;
var options = [];
for(var i= 0, len=resultList.length;i<len;i++){
var option = resultList[i];
option.id = resultList[i]["materialNo"];
option.text = resultList[i]["materialNo"];
options.push(option);
}
return {
results: options,
pagination: {
// more:res["data"]["more"]
}
};
},
escapeMarkup: function (markup) { return markup; },
// minimumInputLength: 1
}
});
$('#materialNo').on('select2:select', function (e) {
var data = e.params.data;
$("input[name='materialName']").val(data.materialName);
$("input[name='brand']").val(data.brand);
$("textarea[name='describe']").val(data.describe);
$("#selectMaterialType").val([data.materialType]).trigger("change");
$("select[name='processMethod']").val([data.processMethod]).trigger("change");
$("select[name='unit']").val([data.unit]).trigger("change");
});
})
$("#form-bom-add").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/add", $('#form-bom-add').serialize());
}
}
function selMaterialTb(){
var options = {
title: '物料选择',
url: ctx + "/erp/material/select",
callBack: doSubmit
};
$.modal.openOptions(options);
}
function doSubmit(index, layero){
var body = layer.getChildFrame('body', index);
$("#treeId").val(body.find('#treeId').val());
$("#treeName").val(body.find('#treeName').val());
layer.close(index);
}
</script>
</body>
</html>

137
ruoyi-admin/src/main/resources/templates/erp/bom/bom.html

@ -0,0 +1,137 @@
<!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('bom列表')" />
</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>bom号:</label>
<input type="text" name="bomNo"/>
</li>
<li>
<label>料号:</label>
<input type="text" name="materialNo"/>
</li>
<li>
<label>审核状态:</label>
<select name="auditStatus" th:with="type=${@dict.getType('auditStatus')}">
<option value="">所有</option>
<option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
</select>
</li>
<li>
<label>使用状态:</label>
<select name="useStatus" th:with="type=${@dict.getType('useStatus')}">
<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="erp:bom:add">
<i class="fa fa-plus"></i> 添加
</a>
<a class="btn btn-primary single disabled" onclick="$.operate.edit()" shiro:hasPermission="erp:bom:edit">
<i class="fa fa-edit"></i> 修改
</a>
<a class="btn btn-danger multiple disabled" onclick="$.operate.removeAll()" shiro:hasPermission="erp:bom:remove">
<i class="fa fa-remove"></i> 删除
</a>
<a class="btn btn-warning" onclick="$.table.exportExcel()" shiro:hasPermission="erp:bom: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('erp:bom:edit')}]];
var removeFlag = [[${@permission.hasPermi('erp:bom:remove')}]];
var cancelFlag = [[${@permission.hasPermi('erp:bom:cancel')}]];
var restoreFlag = [[${@permission.hasPermi('erp:bom:restore')}]];
var auditStatusDatas = [[${@dict.getType('auditStatus')}]];
var useStatusDatas = [[${@dict.getType('useStatus')}]];
var prefix = ctx + "erp/bom";
$(function() {
var options = {
url: prefix + "/list",
createUrl: prefix + "/add",
updateUrl: prefix + "/edit/{id}",
removeUrl: prefix + "/remove",
cancelUrl: prefix + "/cancel/{id}",
restoreUrl: prefix + "/restore/{id}",
exportUrl: prefix + "/export",
modalName: "bom",
columns: [{
checkbox: true
},
{
field: 'id',
title: '主键ID',
visible: false
},
{
field: 'remark',
title: '备注'
},
{
field: 'bomNo',
title: 'bom号'
},
{
field: 'materialNo',
title: '料号'
},
{
field: 'auditStatus',
title: '审核状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(auditStatusDatas, value);
}
},
{
field: 'useStatus',
title: '使用状态',
formatter: function(value, row, index) {
return $.table.selectDictLabel(useStatusDatas, value);
}
},
{
title: '操作',
align: 'center',
formatter: function(value, row, index) {
var actions = [];
actions.push('<a class="btn btn-success btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.id + '\')"><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.id + '\')"><i class="fa fa-remove"></i>删除</a> ');
if(row.delFlag == '0'){
actions.push('<a class="btn btn-danger btn-xs ' + cancelFlag + '" href="javascript:void(0)" onclick="$.operate.cancel(\'' + row.id + '\')"><i class="fa fa-remove"></i>作废</a> ');
}else{
actions.push('<a class="btn btn-success btn-xs ' + restoreFlag + '" href="javascript:void(0)" onclick="$.operate.restore(\'' + row.id + '\')"><i class="fa fa-window-restore"></i>恢复</a> ');
}
return actions.join('');
}
}]
};
$.table.init(options);
});
</script>
</body>
</html>

62
ruoyi-admin/src/main/resources/templates/erp/bom/edit.html

@ -0,0 +1,62 @@
<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
<th:block th:include="include :: header('修改bom')" />
</head>
<body class="white-bg">
<div class="wrapper wrapper-content animated fadeInRight ibox-content">
<form class="form-horizontal m" id="form-bom-edit" th:object="${erpBom}">
<input name="id" th:field="*{id}" type="hidden">
<div class="form-group">
<label class="col-sm-3 control-label">备注:</label>
<div class="col-sm-8">
<textarea name="remark" class="form-control">[[*{remark}]]</textarea>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">bom号:</label>
<div class="col-sm-8">
<input name="bomNo" th:field="*{bomNo}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">料号:</label>
<div class="col-sm-8">
<input name="materialNo" th:field="*{materialNo}" class="form-control" type="text">
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">审核状态:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('auditStatus')}">
<input type="radio" th:id="${'auditStatus_' + dict.dictCode}" name="auditStatus" th:value="${dict.dictValue}" th:field="*{auditStatus}">
<label th:for="${'auditStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
<div class="form-group">
<label class="col-sm-3 control-label">使用状态:</label>
<div class="col-sm-8">
<div class="radio-box" th:each="dict : ${@dict.getType('useStatus')}">
<input type="radio" th:id="${'useStatus_' + dict.dictCode}" name="useStatus" th:value="${dict.dictValue}" th:field="*{useStatus}">
<label th:for="${'useStatus_' + dict.dictCode}" th:text="${dict.dictLabel}"></label>
</div>
</div>
</div>
</form>
</div>
<th:block th:include="include :: footer" />
<script th:inline="javascript">
var prefix = ctx + "erp/bom";
$("#form-bom-edit").validate({
focusCleanup: true
});
function submitHandler() {
if ($.validate.form()) {
$.operate.save(prefix + "/edit", $('#form-bom-edit').serialize());
}
}
</script>
</body>
</html>
Loading…
Cancel
Save