13 changed files with 3947 additions and 41 deletions
Binary file not shown.
@ -0,0 +1,17 @@ |
|||||
|
{ |
||||
|
"groups": [ |
||||
|
{ |
||||
|
"name": "file", |
||||
|
"type": "com.dreamchaser.depository_manage.config.FileConfig", |
||||
|
"sourceType": "com.dreamchaser.depository_manage.config.FileConfig" |
||||
|
} |
||||
|
], |
||||
|
"properties": [ |
||||
|
{ |
||||
|
"name": "file.upload-path", |
||||
|
"type": "java.lang.String", |
||||
|
"sourceType": "com.dreamchaser.depository_manage.config.FileConfig" |
||||
|
} |
||||
|
], |
||||
|
"hints": [] |
||||
|
} |
||||
@ -0,0 +1,378 @@ |
|||||
|
<?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.dreamchaser.depository_manage.mapper.GroupMapper"> |
||||
|
|
||||
|
<!-- 字段映射 (用于视图)--> |
||||
|
<resultMap id="groupInfoMap" type="com.dreamchaser.depository_manage.entity.GroupInfo"> |
||||
|
<id column="id" property="id" jdbcType="INTEGER" /> |
||||
|
<result column="mid" property="mid" jdbcType="INTEGER"/> |
||||
|
<result column="gid" property="gid" jdbcType="INTEGER"/> |
||||
|
<result column="quantity" property="quantity" jdbcType="INTEGER"/> |
||||
|
<result column="mtid" property="mtid" jdbcType="INTEGER"/> |
||||
|
<result column="shelfLife" property="shelfLife" jdbcType="INTEGER"/> |
||||
|
<result column="gcode" property="gcode" jdbcType="VARCHAR"/> |
||||
|
<result column="mname" property="mname" jdbcType="VARCHAR"/> |
||||
|
<result column="tname" property="tname" jdbcType="VARCHAR"/> |
||||
|
<result column="mcode" property="mcode" jdbcType="VARCHAR"/> |
||||
|
<result column="version" property="version" jdbcType="VARCHAR"/> |
||||
|
<result column="unit" property="unit" jdbcType="VARCHAR"/> |
||||
|
<result column="texture" property="texture" jdbcType="VARCHAR"/> |
||||
|
<result column="productionPlace" property="productionPlace" jdbcType="VARCHAR"/> |
||||
|
<result column="brand" property="brand" jdbcType="VARCHAR"/> |
||||
|
<result column="remark" property="remark" jdbcType="VARCHAR"/> |
||||
|
<result column="gname" property="gname" jdbcType="VARCHAR"/> |
||||
|
<result column="createTime" property="createTime" jdbcType="INTEGER"/> |
||||
|
<result column="gstate" property="gstate" jdbcType="INTEGER"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
<!-- 用于组合映射--> |
||||
|
<resultMap id="groupMap" type="com.dreamchaser.depository_manage.entity.Group"> |
||||
|
<id column="id" property="id" jdbcType="INTEGER" /> |
||||
|
<result column="code" property="code" jdbcType="VARCHAR"/> |
||||
|
<result column="gname" property="gname" jdbcType="VARCHAR"/> |
||||
|
<result column="createTime" property="createTime" jdbcType="INTEGER"/> |
||||
|
<result column="state" property="state" jdbcType="INTEGER"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
<!-- 用于组合与物料的映射--> |
||||
|
<resultMap id="materialForGroupMap" type="com.dreamchaser.depository_manage.entity.MaterialForGroup"> |
||||
|
<id column="id" property="id" jdbcType="INTEGER" /> |
||||
|
<result column="mid" property="mid" jdbcType="INTEGER"/> |
||||
|
<result column="gid" property="gid" jdbcType="INTEGER"/> |
||||
|
<result column="quantity" property="quantity" jdbcType="INTEGER"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
<!-- 用于视图--> |
||||
|
<sql id="allColumnsForView"> |
||||
|
id,mid,gid,quantity,mtid,shelfLife,gcode,mname,tname,mcode,version,unit,texture,productionPlace,brand,remark,createTime,gstate,gname |
||||
|
</sql> |
||||
|
|
||||
|
<!-- 用于组合--> |
||||
|
<sql id="allColumnsForGroup"> |
||||
|
id,code,createTime,state,gname |
||||
|
</sql> |
||||
|
|
||||
|
<!-- 用于物料对于组合的映射--> |
||||
|
<sql id="allColumnsForMaterialForGroup"> |
||||
|
id,mid,gid,quantity |
||||
|
</sql> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<select id="findAllGroup" resultMap="groupInfoMap"> |
||||
|
select |
||||
|
<include refid="allColumnsForView"/> |
||||
|
from materialforgroup |
||||
|
</select> |
||||
|
|
||||
|
<select id="findGroupOnlyByCondition" resultMap="groupMap" parameterType="map"> |
||||
|
select |
||||
|
<include refid="allColumnsForGroup"/> |
||||
|
from `group` |
||||
|
where 1 = 1 |
||||
|
<if test="code != null and code !=''"> |
||||
|
and code = #{code} |
||||
|
</if> |
||||
|
<if test="gid != null and gid != ''"> |
||||
|
and id = #{gid} |
||||
|
</if> |
||||
|
<if test="createTime != null and createTime != ''"> |
||||
|
and createTime = #{createTime} |
||||
|
</if> |
||||
|
<if test="state != null and state != ''"> |
||||
|
and state = #{state} |
||||
|
</if> |
||||
|
<if test="gname != null and gname != ''"> |
||||
|
and gname like concat('%',#{gname},'%') |
||||
|
</if> |
||||
|
<if test="begin != null and size != null"> |
||||
|
LIMIT #{begin},#{size} |
||||
|
</if> |
||||
|
</select> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<select id="findGroupOnlyById" resultMap="groupMap" parameterType="int"> |
||||
|
select |
||||
|
<include refid="allColumnsForGroup"/> |
||||
|
from `group` |
||||
|
where id = #{id} |
||||
|
</select> |
||||
|
|
||||
|
<select id="findAllGroupOnly" resultMap="groupMap" parameterType="string"> |
||||
|
select |
||||
|
<include refid="allColumnsForGroup"/> |
||||
|
from `group` |
||||
|
where state = 1 |
||||
|
<if test="gname != null and gname != ''"> |
||||
|
and gname like concat('%',#{gname},'%') |
||||
|
</if> |
||||
|
</select> |
||||
|
|
||||
|
|
||||
|
<select id="findAllGroupOnlyCount" resultType="int" parameterType="map"> |
||||
|
select |
||||
|
Count(*) |
||||
|
from `group` |
||||
|
where 1 = 1 |
||||
|
<if test="code != null and code !=''"> |
||||
|
and code = #{code} |
||||
|
</if> |
||||
|
<if test="createTime != null and createTime != ''"> |
||||
|
and createTime = #{createTime} |
||||
|
</if> |
||||
|
<if test="state != null and state != ''"> |
||||
|
and state = #{state} |
||||
|
</if> |
||||
|
</select> |
||||
|
|
||||
|
<select id="findGroupById" resultMap="groupInfoMap" parameterType="int"> |
||||
|
select |
||||
|
<include refid="allColumnsForView"/> |
||||
|
from materialforgroup |
||||
|
where id = #{id} |
||||
|
</select> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<insert id="addGroup" useGeneratedKeys="true" keyProperty="id"> |
||||
|
INSERT INTO `group` ( |
||||
|
id, code, createTime, state |
||||
|
) VALUES ( |
||||
|
#{id}, |
||||
|
#{code}, |
||||
|
#{createTime}, |
||||
|
#{state} |
||||
|
) |
||||
|
</insert> |
||||
|
|
||||
|
<insert id="addGroupForMaterial"> |
||||
|
INSERT INTO groupformaterial ( |
||||
|
id, mid, gid, quantity |
||||
|
) VALUES ( |
||||
|
#{id}, |
||||
|
#{mid}, |
||||
|
#{gid}, |
||||
|
#{quantity} |
||||
|
) |
||||
|
</insert> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<select id="findGroupByCondition" resultMap="groupInfoMap" parameterType="map"> |
||||
|
select |
||||
|
<include refid="allColumnsForView"/> |
||||
|
from materialforgroup |
||||
|
where 1 = 1 |
||||
|
<if test="mid != null and mid != ''"> |
||||
|
and mid = #{mid} |
||||
|
</if> |
||||
|
<if test="gid != null and gid != ''"> |
||||
|
and gid = #{gid} |
||||
|
</if> |
||||
|
<if test="quantity != null"> |
||||
|
and quantity = #{quantity} |
||||
|
</if> |
||||
|
<if test="gcode != null and gcode !=''"> |
||||
|
and gcode = #{gcode} |
||||
|
</if> |
||||
|
<if test="mname != null and mname != ''"> |
||||
|
and mname like CONCAT('%', #{mname}, '%') |
||||
|
</if> |
||||
|
<if test="mtid != null and mtid != ''"> |
||||
|
and mtid = #{mtid} |
||||
|
</if> |
||||
|
<if test="tname != null and tname != ''"> |
||||
|
and tname like CONCAT('%',#{tname},'%') |
||||
|
</if> |
||||
|
<if test="mcode != null and mcode != ''"> |
||||
|
and mcode = #{mcode} |
||||
|
</if> |
||||
|
<if test="version != null and version != ''"> |
||||
|
and version like CONCAT('%',#{version},'%') |
||||
|
</if> |
||||
|
<if test="unit != null and unit != ''"> |
||||
|
and unit like CONCAT('%',#{unit},'%') |
||||
|
</if> |
||||
|
<if test="texture != null and texture != ''"> |
||||
|
and texture like CONCAT('%',#{texture},'%') |
||||
|
</if> |
||||
|
<if test="shelfLife != null and shelfLife != ''"> |
||||
|
and shelfLife = #{shelfLife} |
||||
|
</if> |
||||
|
<if test="productionPlace != null and productionPlace!= ''"> |
||||
|
and productionPlace like CONCAT('%',#{productionPlace},'%') |
||||
|
</if> |
||||
|
<if test="brand != null and brand != ''"> |
||||
|
and brand like CONCAT('%',#{brand},'%') |
||||
|
</if> |
||||
|
<if test="remark != null and remark != ''"> |
||||
|
and remark like CONCAT('%',remark,'%') |
||||
|
</if> |
||||
|
<if test="createTime != null and createTime != ''"> |
||||
|
and createTime = #{createTime} |
||||
|
</if> |
||||
|
<if test="gstate != null and gstate != ''"> |
||||
|
and gstate = #{gstate} |
||||
|
</if> |
||||
|
<if test="gname != null and gname != ''"> |
||||
|
and gname = #{gname} |
||||
|
</if> |
||||
|
<if test="begin != null and size != null"> |
||||
|
LIMIT #{begin},#{size} |
||||
|
</if> |
||||
|
</select> |
||||
|
|
||||
|
|
||||
|
<select id="findGroupInfoByGid" resultMap="groupInfoMap" parameterType="int"> |
||||
|
select |
||||
|
<include refid="allColumnsForView"/> |
||||
|
from materialforgroup |
||||
|
where gid = #{gid} |
||||
|
</select> |
||||
|
|
||||
|
<select id="findGroupByGids" resultMap="groupMap" parameterType="list"> |
||||
|
select |
||||
|
<include refid="allColumnsForGroup"/> |
||||
|
from `group` |
||||
|
where id in |
||||
|
<foreach collection="list" index="index" item="id" open="(" separator="," close=")"> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
</select> |
||||
|
|
||||
|
<select id="findGroupCountByCondition" parameterType="map" resultType="int"> |
||||
|
select |
||||
|
count(*) |
||||
|
from materialforgroup |
||||
|
where 1 = 1 |
||||
|
<if test="mid != null and mid != ''"> |
||||
|
and mid = #{mid} |
||||
|
</if> |
||||
|
<if test="gid != null and gid != ''"> |
||||
|
and gid = #{gid} |
||||
|
</if> |
||||
|
<if test="quantity != null"> |
||||
|
and quantity = #{quantity} |
||||
|
</if> |
||||
|
<if test="gcode != null and gcode !=''"> |
||||
|
and gcode = #{gcode} |
||||
|
</if> |
||||
|
<if test="mname != null and mname != ''"> |
||||
|
and mname like CONCAT('%', #{mname}, '%') |
||||
|
</if> |
||||
|
<if test="mtid != null and mtid != ''"> |
||||
|
and mtid = #{mtid} |
||||
|
</if> |
||||
|
<if test="tname != null and tname != ''"> |
||||
|
and tname like CONCAT('%',#{tname},'%') |
||||
|
</if> |
||||
|
<if test="mcode != null and mcode != ''"> |
||||
|
and mcode = #{mcode} |
||||
|
</if> |
||||
|
<if test="version != null and version != ''"> |
||||
|
and version like CONCAT('%',#{version},'%') |
||||
|
</if> |
||||
|
<if test="unit != null and unit != ''"> |
||||
|
and unit like CONCAT('%',#{unit},'%') |
||||
|
</if> |
||||
|
<if test="texture != null and texture != ''"> |
||||
|
and texture like CONCAT('%',#{texture},'%') |
||||
|
</if> |
||||
|
<if test="shelfLife != null and shelfLife != ''"> |
||||
|
and shelfLife = #{shelfLife} |
||||
|
</if> |
||||
|
<if test="productionPlace != null and productionPlace!= ''"> |
||||
|
and productionPlace like CONCAT('%',#{productionPlace},'%') |
||||
|
</if> |
||||
|
<if test="brand != null and brand != ''"> |
||||
|
and brand like CONCAT('%',#{brand},'%') |
||||
|
</if> |
||||
|
<if test="remark != null and remark != ''"> |
||||
|
and remark like CONCAT('%',remark,'%') |
||||
|
</if> |
||||
|
<if test="createTime != null and createTime != ''"> |
||||
|
and createTime = #{createTime} |
||||
|
</if> |
||||
|
<if test="gstate != null and gstate != ''"> |
||||
|
and gstate = #{gstate} |
||||
|
</if> |
||||
|
</select> |
||||
|
|
||||
|
<update id="updateMaterialForGroup"> |
||||
|
update |
||||
|
groupformaterial |
||||
|
<set> |
||||
|
<if test="gid != null and gid != ''"> |
||||
|
gid = #{gid}, |
||||
|
</if> |
||||
|
<if test="mid != null and mid != ''"> |
||||
|
mid = #{mid}, |
||||
|
</if> |
||||
|
<if test="quantity != null and quantity != ''"> |
||||
|
quantity = #{quantity} |
||||
|
</if> |
||||
|
</set> |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<select id="findQrCodeByGid" parameterType="int" resultType="String"> |
||||
|
select code |
||||
|
from gidandcode |
||||
|
where gid = #{gid} |
||||
|
</select> |
||||
|
|
||||
|
<insert id="addQrCodeByGroup"> |
||||
|
insert into gidandcode(id,gid,code) |
||||
|
values ( |
||||
|
#{id}, |
||||
|
#{gid}, |
||||
|
#{code} |
||||
|
) |
||||
|
</insert> |
||||
|
|
||||
|
|
||||
|
<update id="updateGroupOnly"> |
||||
|
update |
||||
|
`group` |
||||
|
<set> |
||||
|
<if test="code != null and code != ''"> |
||||
|
code = #{code}, |
||||
|
</if> |
||||
|
<if test="createTime != null and createTime != ''"> |
||||
|
createTime = #{createTime}, |
||||
|
</if> |
||||
|
<if test="state != null and state != ''"> |
||||
|
state = #{state}, |
||||
|
</if> |
||||
|
<if test="gname != null and gname !=''"> |
||||
|
gname = #{gname} |
||||
|
</if> |
||||
|
</set> |
||||
|
where id = #{id} |
||||
|
</update> |
||||
|
|
||||
|
<delete id="delMaterialForGroupById" parameterType="int"> |
||||
|
delete from groupformaterial where id = #{id} |
||||
|
</delete> |
||||
|
|
||||
|
|
||||
|
<delete id="delMaterialForGroupByIds" parameterType="list"> |
||||
|
delete from groupformaterial where id in |
||||
|
<foreach collection="list" index="index" item="id" open="(" separator="," close=")"> |
||||
|
#{id} |
||||
|
</foreach> |
||||
|
</delete> |
||||
|
|
||||
|
<delete id="delGroup" parameterType="int"> |
||||
|
delete from `group` where id = #{id} |
||||
|
</delete> |
||||
|
|
||||
|
<select id="findGroupByCode" parameterType="String" resultMap="groupMap"> |
||||
|
select |
||||
|
<include refid="allColumnsForGroup"/> |
||||
|
from `group` |
||||
|
where code = #{code} |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
||||
File diff suppressed because it is too large
@ -0,0 +1,776 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
||||
|
<head> |
||||
|
<meta charset="utf-8"> |
||||
|
<title>分步表单</title> |
||||
|
<meta name="renderer" content="webkit"> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
||||
|
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
||||
|
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
||||
|
<link rel="stylesheet" href="/static/js/lay-module/step-lay/step.css" media="all"> |
||||
|
</head> |
||||
|
|
||||
|
<body> |
||||
|
<style> |
||||
|
.inputdiv { |
||||
|
display: flex; |
||||
|
background-color: #fff; |
||||
|
height: 38px; |
||||
|
line-height: 38px; |
||||
|
border: 1px solid rgb(238, 238, 238); |
||||
|
} |
||||
|
|
||||
|
.layui-form-label { |
||||
|
padding: 9px 0px; |
||||
|
text-align: left; |
||||
|
} |
||||
|
|
||||
|
.layui-input-block { |
||||
|
margin-left: 80px; |
||||
|
} |
||||
|
|
||||
|
.layui-form-select { |
||||
|
width: 100%; |
||||
|
border-style: none; |
||||
|
} |
||||
|
|
||||
|
.layui-card-body { |
||||
|
padding: 10px 5px; |
||||
|
} |
||||
|
|
||||
|
.lay-step { |
||||
|
display: none; |
||||
|
} |
||||
|
|
||||
|
.layui-form-select .layui-input { |
||||
|
border-style: none; |
||||
|
} |
||||
|
</style> |
||||
|
<div class="layuimini-container"> |
||||
|
<div class="layuimini-main"> |
||||
|
<div class="layui-fluid"> |
||||
|
<input id="gidList" type="text" style="display:none;" th:value="${gidList}" > |
||||
|
<div class="layui-carousel" id="stepForm2" lay-filter="stepForm2" style="margin: 0 auto;"> |
||||
|
<div carousel-item style="overflow: inherit"> |
||||
|
<div> |
||||
|
<form class="layui-form layui-form-pane" style="margin: 0 auto;max-width: 460px;"> |
||||
|
<div class="layui-card" id="cardParentForGroup"> |
||||
|
<!--提交按钮--> |
||||
|
<div class="layui-form-item" id="btn_sub2"> |
||||
|
<div class="layui-input-block"> |
||||
|
<button class="layui-btn" lay-submit lay-filter="formStep2" type="button" |
||||
|
style="margin-bottom: 30px;margin-left: 15%"> |
||||
|
 提交  |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
<div> |
||||
|
<form class="layui-form" style="margin: 0 auto;max-width: 460px;padding-top: 40px;"> |
||||
|
<div style="text-align: center;margin-top: 90px;"> |
||||
|
<i class="layui-icon layui-circle" |
||||
|
style="color: white;font-size:30px;font-weight:bold;background: #52C41A;padding: 20px;line-height: 80px;"></i> |
||||
|
<div style="font-size: 24px;color: #333;font-weight: 500;margin-top: 30px;"> |
||||
|
提交申请成功 |
||||
|
</div> |
||||
|
</div> |
||||
|
<div style="text-align: center;margin-top: 50px;"> |
||||
|
<button class="layui-btn next">再申请一次</button> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
||||
|
<script src="/static/js/lay-config.js?v=1.0.4" charset="utf-8"></script> |
||||
|
<script> |
||||
|
// 用于重新构造页面中的组合明细 |
||||
|
function CoverpageForGroupInfo(){} |
||||
|
|
||||
|
// 用于重新构造页面 |
||||
|
function CoverPageForGroup(){} |
||||
|
|
||||
|
// 用于实现卡片添加 |
||||
|
function addItemForGroup(){} |
||||
|
|
||||
|
// 用于判断当前组合数量是否合适 |
||||
|
function groupQuantityIsTrue() { |
||||
|
} |
||||
|
|
||||
|
// 用于组合名称查询 |
||||
|
function selectGroupByName() { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
// 用于点击搜索按钮(组合) |
||||
|
function selectGroup(obj) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
// 用于删除标签(用于组合) |
||||
|
function deleteItemForGroup(obj) { |
||||
|
} |
||||
|
|
||||
|
// 用于编码查询(用于组合) |
||||
|
function selectCodeForGroup(obj) { |
||||
|
} |
||||
|
|
||||
|
// 用于暂存卡片个数(组合) |
||||
|
var params2 = []; |
||||
|
// 用于卡片编号 |
||||
|
var NewIdNumber = 1; |
||||
|
layui.use(['form', 'step', 'layer', 'jquery', 'element'], function () { |
||||
|
var $ = layui.$, |
||||
|
form = layui.form, |
||||
|
element = layui.element, |
||||
|
step = layui.step; |
||||
|
|
||||
|
// 用于分步表单加载 |
||||
|
step.render({ |
||||
|
elem: '#stepForm2', |
||||
|
filter: 'stepForm2', |
||||
|
width: '100%', //设置容器宽度 |
||||
|
height: '600px', |
||||
|
stepItems: [{ |
||||
|
title: '填写信息' |
||||
|
}, { |
||||
|
title: '提交成功' |
||||
|
}] |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
// 提交(组合出库) |
||||
|
form.on('submit(formStep2)', function (data) { |
||||
|
data = data.field; |
||||
|
data.params = params2; |
||||
|
if (data.gid === undefined) { |
||||
|
// 如果没有初始项 |
||||
|
var dataKeys = Object.keys(data); |
||||
|
var dataKey; |
||||
|
for (let i = 0; i < dataKeys.length; i++) { |
||||
|
dataKey = dataKeys[i]; |
||||
|
if (dataKey.includes("gid")) { |
||||
|
break; |
||||
|
} |
||||
|
} |
||||
|
// 获取当前数字 |
||||
|
var keyNumber = dataKey.split("gid")[1]; |
||||
|
for (let index = 0; index < dataKeys.length; index++) { |
||||
|
var tempKey = dataKeys[index]; |
||||
|
if (tempKey.includes(keyNumber)) { |
||||
|
var key = tempKey.replace(keyNumber, ""); |
||||
|
data[key] = data[tempKey]; |
||||
|
delete data[tempKey]; |
||||
|
} |
||||
|
} |
||||
|
data.params = remove(data.params, Number(keyNumber)); |
||||
|
} |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: "/group/applicationOutForGroup", |
||||
|
type: 'post', |
||||
|
dataType: 'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
data: JSON.stringify(data), |
||||
|
beforeSend: function () { |
||||
|
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); |
||||
|
}, |
||||
|
success: function (d) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (d.status >= 300) { |
||||
|
layer.msg(d.statusInfo.detail);//失败的表情 |
||||
|
|
||||
|
} else { |
||||
|
layer.msg("申请提交成功", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
||||
|
}, function () { |
||||
|
step.next('#stepForm2'); |
||||
|
}); |
||||
|
} |
||||
|
}, |
||||
|
complete: function () { |
||||
|
layer.close(this.layerIndex); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
$('.pre').click(function () { |
||||
|
step.pre('#stepForm2'); |
||||
|
}); |
||||
|
|
||||
|
$('.next').click(function () { |
||||
|
step.next('#stepForm2'); |
||||
|
}); |
||||
|
// 获取当前gid列表 |
||||
|
let gidList = JSON.parse($("#gidList").val()); |
||||
|
|
||||
|
// 页面初始化 |
||||
|
$(function () { |
||||
|
let req = {}; |
||||
|
for (let i = 0; i < gidList.length; i++) { |
||||
|
req.gid = gidList[i]; |
||||
|
$.ajax({ |
||||
|
url: "/group/findGroupInfoByGid", |
||||
|
data: JSON.stringify(req), |
||||
|
type: 'post', |
||||
|
dataType: 'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
if(d.status === 666){ |
||||
|
layer.msg(d.statusInfo.detail,{ |
||||
|
icon:0, |
||||
|
time:1000, |
||||
|
},function () { |
||||
|
// 关闭当前页 |
||||
|
var index = parent.layer.getFrameIndex(window.name); |
||||
|
parent.layer.close(index); |
||||
|
}) |
||||
|
}else { |
||||
|
var data = d.data; |
||||
|
CoverPageForGroup(i, data[0]); |
||||
|
form.render(); |
||||
|
for (let j = 0; j < data.length; j++) { |
||||
|
CoverpageForGroupInfo(i, data[j]); |
||||
|
} |
||||
|
element.init(); |
||||
|
form.render(); |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// 用于重新渲染页面的组合明细 |
||||
|
CoverpageForGroupInfo = function (num, obj) { |
||||
|
// 获取待添加父类 |
||||
|
NewIdNumber = num; |
||||
|
if (num === 0) { // 如果是第一个 |
||||
|
NewIdNumber = ""; |
||||
|
} |
||||
|
var materialItem = ` |
||||
|
|
||||
|
<div class="layui-collapse"> |
||||
|
<div class="layui-colla-item"> |
||||
|
<h2 class="layui-colla-title"">${obj.mname}</h2> |
||||
|
<div class="layui-colla-content"> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">物料编码:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" placeholder="请填写入物料编码" value="${obj.mcode}" |
||||
|
readonly |
||||
|
class="layui-input" required> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">物料数量:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<input type="number" placeholder="请填写入物料数量" value="${obj.quantity}" |
||||
|
readonly |
||||
|
class="layui-input" lay-verify="number" required> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">物料型号:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" placeholder="请填写入物料型号" value="${obj.version === null ? '' : obj.version}" |
||||
|
readonly |
||||
|
class="layui-input" required> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">物料类型:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" placeholder="请填写入物料类型" value="${obj.tname}" |
||||
|
readonly |
||||
|
class="layui-input" lay-verify="text" required> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">计量单位:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" placeholder="请填写入物料计量单位" value="${obj.unit === null ? '' : obj.unit}" |
||||
|
readonly |
||||
|
class="layui-input" lay-verify="text" required> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
`; // 最终 |
||||
|
// 获取当前高度 |
||||
|
var height = parseInt(($("#stepForm2").css('height')).split("px")[0]); |
||||
|
if (NewIdNumber !== "") { |
||||
|
params2.push(NewIdNumber) |
||||
|
} |
||||
|
$("#stepForm2").css("height", height + 183 + 'px'); |
||||
|
$("#" + "addItemForGroup" + NewIdNumber).before(materialItem); |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
// 用于重新构造页面 |
||||
|
CoverPageForGroup =function (num,obj) { |
||||
|
if(num === 0){ |
||||
|
num = ''; |
||||
|
}else{ |
||||
|
params2.push(num); |
||||
|
} |
||||
|
var materialItem = `<div class="layui-card-body" id=` + "cardItemForGroup" + num + `> |
||||
|
<hr> |
||||
|
<i class="layui-icon layui-icon-subtraction" style="display: inline" |
||||
|
onclick="deleteItemForGroup(this)"></i> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">组合名称:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<div class="inputdiv"> |
||||
|
<input type="text" placeholder="请选择组合" class="layui-input" value="${obj.gname}" |
||||
|
style="border-style: none" |
||||
|
id=`+"openGroupList"+num+` onblur="selectGroupByName(this)" |
||||
|
lay-verify="required"/> |
||||
|
<i class="layui-icon layui-icon-search" |
||||
|
style="display: inline" |
||||
|
id=`+"selectGroup"+num+` onclick="selectGroup(this)"></i> |
||||
|
</div> |
||||
|
<input type="text" value="${obj.gid}" name=`+"gid"+num+` class="layui-input" id=`+"gid"+num+` |
||||
|
style="display: none" lay-verify="required"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">组合编码:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<div class="inputdiv"> |
||||
|
<input id=` + "gcode" + ` name=` + "code" + num + ` type="text" placeholder="请填写入组合编码" |
||||
|
onblur="selectCodeForGroup(this)" value="${obj.gcode}" |
||||
|
class="layui-input" lay-verify="required" |
||||
|
style="border-style: none"> |
||||
|
<img src="/static/images/search.ico" height="16" width="16" |
||||
|
style="margin-top: 10px;display: none" onclick="scanCodeByOut(this)"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">组合数量:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<input type="number" name=`+"quantity"+num+` class="layui-input" id=`+"quantityForGroup"+num+` |
||||
|
required lay-verify="number" onblur="groupQuantityIsTrue(this)" placeholder="请填写组合数量"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">备注说明:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<input name=`+"applyRemark"+num+` placeholder="请填写相关原因及申请原因" value="" |
||||
|
class="layui-input"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
<i class="layui-icon layui-icon-addition" style="display: inline" id=` + "addItemForGroup" + num + ` |
||||
|
onclick="addItemForGroup(this)"></i> |
||||
|
|
||||
|
</div> |
||||
|
|
||||
|
`; |
||||
|
|
||||
|
// 获取当前高度 |
||||
|
var height = parseInt(($("#stepForm2").css('height')).split("px")[0]); |
||||
|
$("#stepForm2").css("height", height + 289 + 'px'); |
||||
|
if(num === ''){ |
||||
|
$("#btn_sub2").before(materialItem); |
||||
|
}else{ |
||||
|
num = num - 1; |
||||
|
if(num === 0){ |
||||
|
num = ''; |
||||
|
} |
||||
|
$("#"+"cardItemForGroup"+num).after(materialItem); |
||||
|
} |
||||
|
}; |
||||
|
|
||||
|
// 实现卡片添加(组合) |
||||
|
addItemForGroup = function (obj) { |
||||
|
var parentId = obj.parentNode.id; |
||||
|
NewIdNumber = NewIdNumber + 1; |
||||
|
var materialItem = ` |
||||
|
<div class="layui-card-body" id=` + "cardItemForGroup" + NewIdNumber + `> |
||||
|
<hr> |
||||
|
<i class="layui-icon layui-icon-subtraction" style="display: inline" |
||||
|
onclick="deleteItemForGroup(this)"></i> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">组合名称:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<div class="inputdiv"> |
||||
|
<input type="text" placeholder="请选择组合" class="layui-input" |
||||
|
style="border-style: none" |
||||
|
id=`+"openGroupList"+NewIdNumber+` onblur="selectGroupByName(this)" |
||||
|
lay-verify="required"/> |
||||
|
<i class="layui-icon layui-icon-search" |
||||
|
style="display: inline" |
||||
|
id=`+"selectGroup"+NewIdNumber+` onclick="selectGroup(this)"></i> |
||||
|
</div> |
||||
|
<input type="text" name=`+"gid"+NewIdNumber+` class="layui-input" id=`+"gid"+NewIdNumber+` |
||||
|
style="display: none" lay-verify="required"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">组合编码:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<div class="inputdiv"> |
||||
|
<input id=` + "gcode" + ` name=` + "code" + NewIdNumber + ` type="text" placeholder="请填写入组合编码" value="" |
||||
|
onblur="selectCodeForGroup(this)" |
||||
|
class="layui-input" lay-verify="required" |
||||
|
style="border-style: none"> |
||||
|
<img src="/static/images/search.ico" height="16" width="16" |
||||
|
style="margin-top: 10px;display: none" onclick="scanCodeByOut(this)"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">组合数量:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<input type="number" name=`+"quantity"+NewIdNumber+` class="layui-input" id=`+"quantityForGroup"+NewIdNumber+` |
||||
|
required lay-verify="number" onblur="groupQuantityIsTrue(this)" placeholder="请填写组合数量"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">备注说明:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<input name=`+"applyRemark"+NewIdNumber+` placeholder="请填写相关原因及申请原因" value="" |
||||
|
class="layui-input"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
<i class="layui-icon layui-icon-addition" style="display: inline" id=` + "addItemForGroup" + NewIdNumber + ` |
||||
|
onclick="addItemForGroup(this)"></i> |
||||
|
|
||||
|
</div> |
||||
|
`; |
||||
|
// 获取当前高度 |
||||
|
var height = parseInt(($("#stepForm2").css('height')).split("px")[0]); |
||||
|
params2.push(NewIdNumber); |
||||
|
$("#stepForm2").css("height", height + 289 + 'px'); |
||||
|
$("#" + parentId).after(materialItem); |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
// 用于实现通过编码查询组合 |
||||
|
selectCodeForGroup = function (obj) { |
||||
|
// 输入code |
||||
|
var code = obj.value; |
||||
|
// 获取搜索的对应卡片 |
||||
|
var parent = obj.parentNode.parentNode.parentNode.parentNode; |
||||
|
var pid = Number(parent.id.split("cardItemForGroup")[1]); |
||||
|
|
||||
|
// 获取当前卡片中的组合名称等 |
||||
|
let gnameParent = parent.childNodes[5].childNodes[3]; |
||||
|
|
||||
|
// gid |
||||
|
let gidItem = gnameParent.childNodes[3]; |
||||
|
// gname |
||||
|
let gnameItem = gnameParent.childNodes[1].childNodes[1]; |
||||
|
let req = {}; |
||||
|
req.code = code; |
||||
|
$.ajax({ |
||||
|
url: "/group/findGroupByCode", |
||||
|
type: "post", |
||||
|
dataType: 'json', |
||||
|
data: JSON.stringify(req), |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
var data = d.data; |
||||
|
if (data === null) { |
||||
|
layer.msg(d.statusInfo.detail, { |
||||
|
icon: 0, |
||||
|
time: 1500 |
||||
|
},function () { |
||||
|
obj.value = ''; |
||||
|
gidItem.value = ''; |
||||
|
gnameItem.value = ''; |
||||
|
let childNodes = parent.childNodes; |
||||
|
for (let i = 0; i < childNodes.length; i++) { |
||||
|
if (childNodes[i].className === "layui-collapse") { |
||||
|
childNodes[i].remove() |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
let childNodes = parent.childNodes; |
||||
|
if (childNodes.length > 9) { |
||||
|
for (let i = 0; i < childNodes.length; i++) { |
||||
|
if (childNodes[i].className === "layui-collapse") { |
||||
|
childNodes[i].remove() |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
// 赋值给gname |
||||
|
gnameItem.value = data[0].gname; |
||||
|
gidItem.value = data[0].gid; |
||||
|
for (let i = 0; i < data.length; i++) { |
||||
|
CoverpageForGroupInfo(pid, data[i]); |
||||
|
} |
||||
|
element.init(); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
// 用于实现点击搜索按钮(组合) |
||||
|
selectGroup = function(obj){ |
||||
|
var parent = obj.parentNode.parentNode.parentNode.parentNode; |
||||
|
var parentId = parent.id; |
||||
|
|
||||
|
// 获取对应元素 |
||||
|
var pid = Number(parent.id.split("cardItemForGroup")[1]); |
||||
|
|
||||
|
// 获取当前卡片中的组合名称等 |
||||
|
let gnameParent = parent.childNodes[5].childNodes[3]; |
||||
|
|
||||
|
// 组合编码 |
||||
|
let gcodeItem = parent.childNodes[7].childNodes[3].childNodes[1].childNodes[1]; |
||||
|
|
||||
|
|
||||
|
// gid |
||||
|
let gidItem = gnameParent.childNodes[3]; |
||||
|
|
||||
|
// gname |
||||
|
let gnameItem = gnameParent.childNodes[1].childNodes[1]; |
||||
|
|
||||
|
let gname = gnameItem.value; |
||||
|
layer.open({ |
||||
|
type: 2, |
||||
|
title: '弹窗内容', |
||||
|
skin: 'layui-layer-rim', |
||||
|
maxmin: true, |
||||
|
shadeClose: true, //点击遮罩关闭层 |
||||
|
area: ['70%', '70%'], |
||||
|
content: '/selectGroup?gname=' + gname + '&clickObj=' + parentId, |
||||
|
move: '.layui-layer-title', |
||||
|
fixed: false, |
||||
|
success: function (layero, index) { |
||||
|
var children = layero.children(); |
||||
|
var content = $(children[1]); |
||||
|
var iframeChildren = $(content.children()); |
||||
|
content.css('height', '100%'); |
||||
|
iframeChildren.css('height', '100%'); |
||||
|
}, |
||||
|
end:function () { |
||||
|
let gid = gidItem.value; |
||||
|
if(gid !== ''){ |
||||
|
let req = {}; |
||||
|
req.gid = gid; |
||||
|
$.ajax({ |
||||
|
url: "/group/findGroupInfoByGid", |
||||
|
data: JSON.stringify(req), |
||||
|
type: 'post', |
||||
|
dataType: 'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
var data = d.data; |
||||
|
if (data === null) { |
||||
|
layer.msg(d.statusInfo.detail, { |
||||
|
icon: 0, |
||||
|
time: 1500 |
||||
|
},function () { |
||||
|
obj.value = ''; |
||||
|
gidItem.value = ''; |
||||
|
gnameItem.value = ''; |
||||
|
let childNodes = parent.childNodes; |
||||
|
for (let i = 0; i < childNodes.length; i++) { |
||||
|
if (childNodes[i].className === "layui-collapse") { |
||||
|
childNodes[i].remove() |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
} else { |
||||
|
let childNodes = parent.childNodes; |
||||
|
if (childNodes.length > 9) { |
||||
|
for (let i = 0; i < childNodes.length; i++) { |
||||
|
if (childNodes[i].className === "layui-collapse") { |
||||
|
childNodes[i].remove() |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
// 赋值给gname |
||||
|
gcodeItem.value = data[0].gcode; |
||||
|
for (let i = 0; i < data.length; i++) { |
||||
|
CoverpageForGroupInfo(pid, data[i]); |
||||
|
} |
||||
|
element.init(); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}; |
||||
|
|
||||
|
// 用于实现组合名称搜索 |
||||
|
selectGroupByName = function(obj){ |
||||
|
let gname = obj.value; |
||||
|
var parent = obj.parentNode.parentNode.parentNode.parentNode; |
||||
|
// 获取对应元素 |
||||
|
var pid = Number(parent.id.split("cardItemForGroup")[1]); |
||||
|
|
||||
|
// 获取当前卡片中的组合名称等 |
||||
|
let gnameParent = parent.childNodes[5].childNodes[3]; |
||||
|
|
||||
|
// 组合编码 |
||||
|
let gcodeItem = parent.childNodes[7].childNodes[3].childNodes[1].childNodes[1]; |
||||
|
|
||||
|
|
||||
|
// gid |
||||
|
let gidItem = gnameParent.childNodes[3]; |
||||
|
|
||||
|
if(gname !== ''){ |
||||
|
|
||||
|
|
||||
|
var req = {}; |
||||
|
req.gname = gname; |
||||
|
$.ajax({ |
||||
|
url: "/group/findGroupByGname", |
||||
|
type: "post", |
||||
|
dataType: 'json', |
||||
|
data: JSON.stringify(req), |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
if(d.count === -1){ |
||||
|
// 如果当前组合名称的数量不止一个 |
||||
|
layer.msg("请点击右侧搜索确定物品", { |
||||
|
icon: 0, |
||||
|
time: 1500 |
||||
|
},function () { |
||||
|
obj.value = ''; |
||||
|
gidItem.value = ''; |
||||
|
gcodeItem.value = ''; |
||||
|
let childNodes = parent.childNodes; |
||||
|
for (let i = 0; i < childNodes.length; i++) { |
||||
|
if (childNodes[i].className === "layui-collapse") { |
||||
|
childNodes[i].remove() |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}else if(d.count === 0){ |
||||
|
// 如果当前组合名称不存在 |
||||
|
layer.msg("没有该组合,请确认输入是否正确", { |
||||
|
icon: 0, |
||||
|
time: 1500 |
||||
|
},function () { |
||||
|
obj.value = ''; |
||||
|
gidItem.value = ''; |
||||
|
gcodeItem.value = ''; |
||||
|
let childNodes = parent.childNodes; |
||||
|
for (let i = 0; i < childNodes.length; i++) { |
||||
|
if (childNodes[i].className === "layui-collapse") { |
||||
|
childNodes[i].remove() |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}else{ |
||||
|
// 正常 |
||||
|
let data = d.data; |
||||
|
let childNodes = parent.childNodes; |
||||
|
if (childNodes.length > 9) { |
||||
|
for (let i = 0; i < childNodes.length; i++) { |
||||
|
if (childNodes[i].className === "layui-collapse") { |
||||
|
childNodes[i].remove() |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
// 赋值给gname |
||||
|
gidItem.value = data[0].gid; |
||||
|
gcodeItem.value = data[0].gcode; |
||||
|
for (let i = 0; i < data.length; i++) { |
||||
|
CoverpageForGroupInfo(pid, data[i]); |
||||
|
} |
||||
|
element.init(); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
else{ |
||||
|
gcodeItem.value = ''; |
||||
|
gidItem.value = ''; |
||||
|
let childNodes = parent.childNodes; |
||||
|
for (let i = 0; i < childNodes.length; i++) { |
||||
|
if (childNodes[i].className === "layui-collapse") { |
||||
|
childNodes[i].remove() |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
//用于判断当前组合数量是否合适 |
||||
|
groupQuantityIsTrue = function (obj) { |
||||
|
var id = obj.id.split("quantityForGroup")[1]; |
||||
|
var gid = $("#gid" + id).val(); // 获取到当前输入的物料编码 |
||||
|
if (gid === "" || gid === undefined || gid === null) { |
||||
|
layer.msg("请输入正确的组合!", {icon: 0, time: 500}, function () { |
||||
|
$("#quantityForGroup" + id).val("") |
||||
|
}); |
||||
|
} else { |
||||
|
let val = $("#quantityForGroup" + id).val(); |
||||
|
if (val !== null && val !== undefined && val !== '') { |
||||
|
var req = {}; |
||||
|
req.gid = gid; |
||||
|
req.quantity = val; |
||||
|
$.ajax({ |
||||
|
url: "/group/groupQuantityIsTrue", |
||||
|
type: "post", |
||||
|
data: JSON.stringify(req), |
||||
|
dataType: 'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (res) { |
||||
|
|
||||
|
var flag = res.data; |
||||
|
if (!flag) { // 如果当前数目不合适 |
||||
|
layer.msg("当前组合中有物料库存数量不足", {icon: 0, time: 500}, function () { |
||||
|
$("#quantityForGroup" + id).val(""); |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
// 实现卡片删除(组合) |
||||
|
deleteItemForGroup = function (obj) { |
||||
|
// 获取父节点 |
||||
|
var parent = obj.parentNode; |
||||
|
var parentId = parent.id; |
||||
|
parentId = parseInt(parentId.split("cardItemForGroup")[1]); |
||||
|
// 获取祖父节点 |
||||
|
var reparent = parent.parentNode; |
||||
|
var height = parseInt(($("#stepForm2").css('height')).split("px")[0]); |
||||
|
$("#stepForm2").css("height", height - 289 + 'px'); |
||||
|
params2 = remove(params2, parentId); |
||||
|
reparent.removeChild(parent); |
||||
|
}; |
||||
|
|
||||
|
|
||||
|
//删除数组中指定元素 |
||||
|
function remove(arr, item) { |
||||
|
var result = []; |
||||
|
for (let i = 0; i < arr.length; i++) { |
||||
|
if (arr[i] === item) { |
||||
|
continue; |
||||
|
} |
||||
|
result.push(arr[i]); |
||||
|
} |
||||
|
return result; |
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,260 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
||||
|
<head> |
||||
|
<meta charset="utf-8"> |
||||
|
<title>layui</title> |
||||
|
<meta name="renderer" content="webkit"> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
||||
|
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
||||
|
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
||||
|
</head> |
||||
|
<body> |
||||
|
|
||||
|
<div class="layuimini-container"> |
||||
|
<div class="layuimini-main"> |
||||
|
|
||||
|
<script id="toolbarDemo" type="text/html"> |
||||
|
<div class="layui-btn-container"> |
||||
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="delete">删除</button> |
||||
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="applicationOut">出库</button> |
||||
|
</div> |
||||
|
</script> |
||||
|
|
||||
|
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table> |
||||
|
<script id="currentTableBar" type="text/html"> |
||||
|
<a class="layui-btn layui-btn-xs data-count-edit" lay-event="applicationOut" >出库</a> |
||||
|
</script> |
||||
|
</div> |
||||
|
</div> |
||||
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
||||
|
<script> |
||||
|
var data; |
||||
|
layui.use(['form', 'table'], function () { |
||||
|
var $ = layui.jquery, |
||||
|
form = layui.form, |
||||
|
table = layui.table; |
||||
|
|
||||
|
|
||||
|
table.render({ |
||||
|
elem: "#currentTableId", |
||||
|
url: '/group/applicant_multi_create', |
||||
|
parseData: function (res) { //res 即为原始返回的数据 |
||||
|
return { |
||||
|
"status": res.status, //解析接口状态 |
||||
|
"message": res.statusInfo.message, //解析提示文本 |
||||
|
"count": res.count, //解析数据长度 |
||||
|
"data": res.data //解析数据列表 |
||||
|
}; |
||||
|
}, |
||||
|
request: { |
||||
|
pageName: 'page', //页码的参数名称,默认:page |
||||
|
limitName: 'size' //每页数据量的参数名,默认:limit |
||||
|
}, |
||||
|
response: { |
||||
|
statusName: 'status' //规定数据状态的字段名称,默认:code |
||||
|
,statusCode: 200 //规定成功的状态码,默认:0 |
||||
|
,msgName: 'message' //规定状态信息的字段名称,默认:msg |
||||
|
,countName: 'count' //规定数据总数的字段名称,默认:count |
||||
|
,dataName: 'data' //规定数据列表的字段名称,默认:data |
||||
|
}, |
||||
|
toolbar: '#toolbarDemo', |
||||
|
cols: [ |
||||
|
[ |
||||
|
{type: "checkbox", width: 50}, |
||||
|
{field: 'gname', width: 150, title: '组合名称'}, |
||||
|
{field: 'code', width: 150, title: '组合编码'}, |
||||
|
{title: '拥有物料', width: 700, align: "center"}, |
||||
|
{field: 'quantity', width: 200, title: '数量',edit:'quantity'}, |
||||
|
{title: '操作', minWidth: 200, toolbar: '#currentTableBar', align: "center"}, |
||||
|
] |
||||
|
], |
||||
|
limits: [10, 15, 20, 25, 50,100], |
||||
|
limit: 10, |
||||
|
page: true, |
||||
|
skin: 'line', |
||||
|
done: function (res, curr, count) { |
||||
|
$.each(res['data'], function (i, j) { |
||||
|
let materialSimple = j["materialSimple"]; |
||||
|
let gid = j["id"]; |
||||
|
let keys = Object.keys(materialSimple); |
||||
|
var materialItem = $("[lay-id='currentTableId'] tr:eq(" + (i+1) + ")").children()[3]; |
||||
|
var aItem = materialItem.childNodes[0]; |
||||
|
for (let k = 0; k < keys.length; k++) { |
||||
|
$(aItem).append('<button id='+ gid+' class="layui-btn layui-btn-primary layui-btn-xs" value='+materialSimple[keys[k]]+'>'+keys[k]+'</button>') |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
//监听表格复选框选择 |
||||
|
table.on('checkbox(currentTableFilter)', function (obj) { |
||||
|
console.log(obj) |
||||
|
}); |
||||
|
|
||||
|
table.on('edit(currentTableFilter)', function(obj){ //注:edit是固定事件名,test是table原始容器的属性 lay-filter="对应的值" |
||||
|
|
||||
|
var req = {}; |
||||
|
req.gid = obj.data.id; |
||||
|
req.quantity = obj.data.quantity; |
||||
|
$.ajax({ |
||||
|
url: "/group/groupQuantityIsTrue", |
||||
|
type: "post", |
||||
|
data: JSON.stringify(req), |
||||
|
dataType: 'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (res) { |
||||
|
var flag = res.data; |
||||
|
if (!flag) { // 如果当前数目不合适 |
||||
|
layer.msg("当前组合中有物料库存数量不足", {icon: 0, time: 500}, function () { |
||||
|
obj.update({quantity:1}) |
||||
|
}); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
/** |
||||
|
* toolbar监听事件 |
||||
|
*/ |
||||
|
table.on('toolbar(currentTableFilter)', function (obj) { |
||||
|
|
||||
|
var checkStatus = table.checkStatus('currentTableId') |
||||
|
, data = checkStatus.data; |
||||
|
var req = {}; |
||||
|
req.quantitys = []; |
||||
|
req.gids = []; |
||||
|
for (i = 0, len = data.length; i < len; i++) { |
||||
|
req.quantitys[i] = data[i].quantity; |
||||
|
req.gids[i] = data[i].id; |
||||
|
} |
||||
|
|
||||
|
if(obj.event==='delete'){ |
||||
|
if(req.gids.length > 0) { |
||||
|
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { |
||||
|
$.ajax({ |
||||
|
url: "/group/deleteApplicationToRedis", |
||||
|
type: "post", |
||||
|
data: JSON.stringify(req), |
||||
|
dataType: "json", |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (d.status >= 300) { |
||||
|
layer.msg(d.statusInfo.message);//失败的表情 |
||||
|
return; |
||||
|
} else { |
||||
|
layer.msg("删除成功!", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 1000 |
||||
|
}, //1秒关闭(如果不配置,默认是3秒) |
||||
|
function () { |
||||
|
//do something |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/applicant_multi_create', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
} |
||||
|
}, 'data'); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
}else{ |
||||
|
layer.msg("未选中记录,请确认!"); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
else if(obj.event === 'applicationOut'){ |
||||
|
req.type = "more"; |
||||
|
$.ajax({ |
||||
|
url:"/group/createMultiApplication", |
||||
|
type:"post", |
||||
|
data:JSON.stringify(req), |
||||
|
dataType: "json", |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (d.status >= 300) { |
||||
|
layer.msg(d.statusInfo.message,{ |
||||
|
icon:0, |
||||
|
time:1000 |
||||
|
});//失败的表情 |
||||
|
return; |
||||
|
}else if(d.status === 1234){ |
||||
|
layer.msg(d.data,{ |
||||
|
icon:0, |
||||
|
time:1000 |
||||
|
}) |
||||
|
return |
||||
|
} |
||||
|
else { |
||||
|
layer.msg("申请成功!", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 1000 |
||||
|
}, //1秒关闭(如果不配置,默认是3秒) |
||||
|
function(){ |
||||
|
//do something |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/applicant_multi_create', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
} |
||||
|
}, 'data'); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
table.on('tool(currentTableFilter)', function (obj) { |
||||
|
let data = obj.data; |
||||
|
if(obj.event === 'applicationOut'){ |
||||
|
// 出库申请 |
||||
|
var req = data; |
||||
|
req.type = "one"; |
||||
|
$.ajax({ |
||||
|
url:"/group/createMultiApplication", |
||||
|
type:"post", |
||||
|
data:JSON.stringify(req), |
||||
|
dataType: "json", |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (d.status >= 300) { |
||||
|
layer.msg(d.statusInfo.message,{ |
||||
|
icon:0, |
||||
|
time:1000 |
||||
|
});//失败的表情 |
||||
|
return; |
||||
|
} else { |
||||
|
layer.msg("申请成功!", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 1000 |
||||
|
}, //1秒关闭(如果不配置,默认是3秒) |
||||
|
function(){ |
||||
|
//do something |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/applicant_multi_create', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
} |
||||
|
}, 'data'); |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
}); |
||||
|
</script> |
||||
|
|
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,340 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
||||
|
<head> |
||||
|
<meta charset="utf-8"> |
||||
|
<title>layui</title> |
||||
|
<meta name="renderer" content="webkit"> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
||||
|
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
||||
|
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div class="layuimini-container"> |
||||
|
<div class="layuimini-main"> |
||||
|
<input style="display: none" id="gid" th:value="${gid}"> |
||||
|
<script id="toolbarDemo" type="text/html"> |
||||
|
<div class="layui-btn-container"> |
||||
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add">添加</button> |
||||
|
</div> |
||||
|
</script> |
||||
|
<fieldset class="table-search-fieldset"> |
||||
|
<legend>搜索信息</legend> |
||||
|
<div style="margin: 10px 10px 10px 10px"> |
||||
|
<form class="layui-form layui-form-pane" action=""> |
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">种类</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" placeholder="请选择物料类型" class="layui-input" id="openSonByMateralType" |
||||
|
readonly/> |
||||
|
<input type="text" id="materialTypeId" placeholder="请选择物料类型" name="materialTypeId" |
||||
|
class="layui-input" style="display: none"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">物料名称</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" name="mname" autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">存货编码</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" name="code" autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-inline"> |
||||
|
<button type="submit" class="layui-btn layui-btn-primary" lay-submit |
||||
|
lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索 |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
</fieldset> |
||||
|
|
||||
|
|
||||
|
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table> |
||||
|
</div> |
||||
|
</div> |
||||
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
||||
|
|
||||
|
<script> |
||||
|
layui.use(['form', 'layer', 'dropdown', 'tree', 'laydate'], function () { |
||||
|
var $ = layui.jquery, |
||||
|
form = layui.form, |
||||
|
table = layui.table; |
||||
|
|
||||
|
// 用于暂存选择的数据 |
||||
|
let checkList = []; |
||||
|
|
||||
|
let gid = $("#gid").val(); |
||||
|
|
||||
|
$('#openSonByMateralType').on('click', function () { |
||||
|
layer.open({ |
||||
|
type: 2, |
||||
|
title: '弹窗内容', |
||||
|
skin: 'layui-layer-rim', |
||||
|
maxmin: true, |
||||
|
shadeClose: true, //点击遮罩关闭层 |
||||
|
area: ['70%', '70%'], |
||||
|
move: '.layui-layer-title', |
||||
|
fixed: false, |
||||
|
content: '/selectType', |
||||
|
success: function (layero, index) { |
||||
|
var children = layero.children(); |
||||
|
var content = $(children[1]); |
||||
|
var iframeChildren = $(content.children()); |
||||
|
content.css('height', '100%'); |
||||
|
iframeChildren.css('height', '100%'); |
||||
|
} |
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
table.render({ |
||||
|
elem: "#currentTableId", |
||||
|
url: '/material/material', |
||||
|
parseData: function (res) { //res 即为原始返回的数据 |
||||
|
return { |
||||
|
"status": res.status, //解析接口状态 |
||||
|
"message": res.statusInfo.message, //解析提示文本 |
||||
|
"count": res.count, //解析数据长度 |
||||
|
"data": res.data //解析数据列表 |
||||
|
}; |
||||
|
}, |
||||
|
request: { |
||||
|
pageName: 'page', //页码的参数名称,默认:page |
||||
|
limitName: 'size' //每页数据量的参数名,默认:limit |
||||
|
}, |
||||
|
response: { |
||||
|
statusName: 'status' //规定数据状态的字段名称,默认:code |
||||
|
, statusCode: 200 //规定成功的状态码,默认:0 |
||||
|
, msgName: 'message' //规定状态信息的字段名称,默认:msg |
||||
|
, countName: 'count' //规定数据总数的字段名称,默认:count |
||||
|
, dataName: 'data' //规定数据列表的字段名称,默认:data |
||||
|
}, |
||||
|
toolbar: '#toolbarDemo', |
||||
|
cols: [ |
||||
|
[ |
||||
|
{type: "checkbox", width: 50}, |
||||
|
{field: 'quantity', width: 200, title: '数量', edit: 'quantity'}, |
||||
|
{field: 'mname', width: 200, title: '物料名称'}, |
||||
|
{field: 'version', width: 250, title: '规格型号'}, |
||||
|
{field: 'code', width: 200, title: '存货编码'}, |
||||
|
{field: 'typeName', width: 200, title: '物料类型'}, |
||||
|
{field: 'unit', width: 200, title: '计量单位'}, |
||||
|
{field: 'texture', width: 200, title: '材质',}, |
||||
|
] |
||||
|
], |
||||
|
limits: [10, 15, 20, 25, 50, 100], |
||||
|
limit: 10, |
||||
|
page: true, |
||||
|
skin: 'line', |
||||
|
done: function (res, curr, count) { |
||||
|
if (checkList.length > 0) { |
||||
|
let count = 0; |
||||
|
|
||||
|
$.each(res['data'], function (i, j) { |
||||
|
let id = j["id"]; |
||||
|
for (let k = 0; k < checkList.length; k++) { |
||||
|
if(checkList[k].id === id){ |
||||
|
let index = j["LAY_TABLE_INDEX"]; |
||||
|
$('tr[data-index=' + index + '] input[type="checkbox"]').prop('checked','true'); |
||||
|
form.render('checkbox'); //刷新checkbox选择框渲染 |
||||
|
count++; |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
if(count === res.data.length){ |
||||
|
// 如果是全选 |
||||
|
$('tr input[type="checkbox"]').prop('checked','true'); |
||||
|
form.render('checkbox'); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
table.on('toolbar(currentTableFilter)', function (obj) { |
||||
|
if (obj.event === 'add') { // 监听添加操作申请操作 |
||||
|
var checkStatus = table.checkStatus('currentTableId') |
||||
|
, data = checkStatus.data; |
||||
|
var req = {}; |
||||
|
req.mids = []; |
||||
|
req.quantitys = []; |
||||
|
let len = data.length; |
||||
|
for (let i = 0; i < len; i++) { |
||||
|
req.mids[i] = data[i].id; |
||||
|
req.quantitys[i] = data[i].quantity; |
||||
|
} |
||||
|
req.len = len; |
||||
|
if (req.mids.length > 0) { |
||||
|
// 如果有,则进行下一步 |
||||
|
if(gid === "-1") { |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: '/group/addGroup', |
||||
|
type: 'post', |
||||
|
dataType: "json", |
||||
|
data: JSON.stringify(req), |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (res) { |
||||
|
if (res.status >= 300) { |
||||
|
layer.msg(res.statusInfo.message);//失败的表情 |
||||
|
return; |
||||
|
} else { |
||||
|
layer.msg("添加成功!", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 1000 |
||||
|
}, //1秒关闭(如果不配置,默认是3秒) |
||||
|
function () { |
||||
|
//do something |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/material/material', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
} |
||||
|
}, 'data') |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
}else{ |
||||
|
req.gid = gid; |
||||
|
$.ajax({ |
||||
|
url: '/group/addMaterialForGroup', |
||||
|
type: 'post', |
||||
|
dataType: "json", |
||||
|
data: JSON.stringify(req), |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (res) { |
||||
|
if (res.status >= 300) { |
||||
|
layer.msg(res.statusInfo.message);//失败的表情 |
||||
|
return; |
||||
|
} else { |
||||
|
layer.msg("添加成功!", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 1000 |
||||
|
}, //1秒关闭(如果不配置,默认是3秒) |
||||
|
function () { |
||||
|
//do something |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/material/material', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
} |
||||
|
}, 'data') |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
} |
||||
|
}else{ |
||||
|
layer.msg("请选择物料",{ |
||||
|
icon:0, |
||||
|
time:500 |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// 监听搜索操作 |
||||
|
form.on('submit(data-search-btn)', function (data) { |
||||
|
var req = {}; |
||||
|
data = data.field; |
||||
|
req.type = 1; |
||||
|
if (data.mname !== '') { |
||||
|
req.mname = data.mname; |
||||
|
} |
||||
|
|
||||
|
if (data.materialTypeId !== '') { |
||||
|
req.materialTypeId = data.materialTypeId; |
||||
|
} |
||||
|
|
||||
|
if (data.code !== '') { |
||||
|
req.code = data.code |
||||
|
} |
||||
|
|
||||
|
//执行搜索重载 |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/material/material', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
where: req |
||||
|
}, 'data'); |
||||
|
return false; |
||||
|
}); |
||||
|
|
||||
|
//监听表格复选框选择 |
||||
|
table.on('checkbox(currentTableFilter)', function (obj) { |
||||
|
if(obj.type === "one") { |
||||
|
// 如果选择的是一个 |
||||
|
if (obj.checked) { |
||||
|
let flag = true; |
||||
|
for (let i = 0; i < checkList.length; i++) { |
||||
|
let data = checkList[i]; |
||||
|
if (data.id === obj.data.id) { |
||||
|
flag = false; |
||||
|
break |
||||
|
} |
||||
|
} |
||||
|
if (flag) { |
||||
|
checkList.push(obj.data); |
||||
|
} |
||||
|
} else { |
||||
|
for (let i = 0; i < checkList.length; i++) { |
||||
|
let data = checkList[i]; |
||||
|
if (data.id === obj.data.id) { |
||||
|
checkList.splice(i, i + 1); |
||||
|
break |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
else{ |
||||
|
// 如果是全选 |
||||
|
|
||||
|
|
||||
|
// 获取选中的数据 |
||||
|
let dataList = table.checkStatus('currentTableId').data; |
||||
|
if (obj.checked) { |
||||
|
for (let i = 0; i < dataList.length; i++) { |
||||
|
let dataItem = dataList[i]; |
||||
|
let flag = true; |
||||
|
for (let j = 0; j < checkList.length; j++) { |
||||
|
let data = checkList[j]; |
||||
|
if (data.id === dataItem.id) { |
||||
|
flag = false; |
||||
|
break |
||||
|
} |
||||
|
} |
||||
|
if (flag) { |
||||
|
checkList.push(dataItem); |
||||
|
} |
||||
|
} |
||||
|
}else{ |
||||
|
dataList = table.getData('currentTableId'); |
||||
|
for (let i = 0; i < dataList.length; i++) { |
||||
|
let dataItem = dataList[i]; |
||||
|
for (let j = 0; j < checkList.length; j++) { |
||||
|
let data = checkList[j]; |
||||
|
if (data.id === dataItem.id) { |
||||
|
checkList.splice(j, j + 1); |
||||
|
break |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
}) |
||||
|
</script> |
||||
|
|
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,542 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
||||
|
<head> |
||||
|
<meta charset="utf-8"> |
||||
|
<title>layui</title> |
||||
|
<meta name="renderer" content="webkit"> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
||||
|
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
||||
|
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div class="layuimini-container"> |
||||
|
<div class="layuimini-main"> |
||||
|
<script id="toolbarDemo" type="text/html"> |
||||
|
<div class="layui-btn-container"> |
||||
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add">创建</button> |
||||
|
<button class="layui-btn layui-btn-danger layui-btn-sm data-delete-btn" lay-event="delete">删除</button> |
||||
|
<button class="layui-btn layui-btn-sm " lay-event="applicationOutAdd">添加</button> |
||||
|
<button class="layui-btn layui-btn-warm layui-btn-sm " lay-event="dispose">处理</button> |
||||
|
</div> |
||||
|
</script> |
||||
|
<fieldset class="table-search-fieldset"> |
||||
|
<legend>搜索信息</legend> |
||||
|
<div style="margin: 10px 10px 10px 10px"> |
||||
|
<form class="layui-form layui-form-pane" action=""> |
||||
|
<div class="layui-form-item"> |
||||
|
|
||||
|
|
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">创建日期</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" name="createTime" id="date" placeholder="请选择创建日期" |
||||
|
autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">组合名称</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" name="name" autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">组合编码</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" name="code" autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">状态</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<select id="state" name="state"> |
||||
|
<option value="" selected>请选择状态</option> |
||||
|
<option value="1">启用</option> |
||||
|
<option value="2">禁用</option> |
||||
|
</select> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-inline"> |
||||
|
<button type="submit" class="layui-btn layui-btn-primary" lay-submit |
||||
|
lay-filter="data-search-btn"><i class="layui-icon"></i> 搜 索 |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
</fieldset> |
||||
|
|
||||
|
|
||||
|
<!-- 状态展示--> |
||||
|
<script type="text/html" id="switchTpl"> |
||||
|
<input type="checkbox" name="state" value="{{d.id}}" lay-skin="switch" lay-text="启用|禁用" |
||||
|
lay-filter="changeState" {{ d.state== 1 ? 'checked' : '' }} > |
||||
|
</script> |
||||
|
|
||||
|
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<script type="text/html" id="currentTableBar"> |
||||
|
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="detail">详情</a> |
||||
|
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a> |
||||
|
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" th:style="'display:'+${display}" |
||||
|
lay-event="realDelete">彻底删除</a> |
||||
|
</script> |
||||
|
<script type="text/html" id="currentTableBarForOut"> |
||||
|
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="applicationOut">出库</a> |
||||
|
</script> |
||||
|
|
||||
|
|
||||
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
||||
|
<script> |
||||
|
// 用于查看并修改组合中的物料信息 |
||||
|
function checkSeeGroup(){}; |
||||
|
layui.use(['form', 'table', 'laydate'], function () { |
||||
|
var $ = layui.jquery, |
||||
|
form = layui.form, |
||||
|
table = layui.table, |
||||
|
laydate = layui.laydate; |
||||
|
|
||||
|
//日期 |
||||
|
laydate.render({ |
||||
|
elem: '#date' |
||||
|
}); |
||||
|
|
||||
|
// 加载表格 |
||||
|
table.render({ |
||||
|
elem: "#currentTableId", |
||||
|
url: '/group/findAllGroup', |
||||
|
parseData: function (res) { //res 即为原始返回的数据 |
||||
|
return { |
||||
|
"status": res.status, //解析接口状态 |
||||
|
"message": res.statusInfo.message, //解析提示文本 |
||||
|
"count": res.count, //解析数据长度 |
||||
|
"data": res.data //解析数据列表 |
||||
|
}; |
||||
|
}, |
||||
|
request: { |
||||
|
pageName: 'page', //页码的参数名称,默认:page |
||||
|
limitName: 'size' //每页数据量的参数名,默认:limit |
||||
|
}, |
||||
|
response: { |
||||
|
statusName: 'status' //规定数据状态的字段名称,默认:code |
||||
|
, statusCode: 200 //规定成功的状态码,默认:0 |
||||
|
, msgName: 'message' //规定状态信息的字段名称,默认:msg |
||||
|
, countName: 'count' //规定数据总数的字段名称,默认:count |
||||
|
, dataName: 'data' //规定数据列表的字段名称,默认:data |
||||
|
}, |
||||
|
toolbar: '#toolbarDemo', |
||||
|
cols: [ |
||||
|
[ |
||||
|
{type: "checkbox", width: 50}, |
||||
|
{field: 'gname', width: 150, title: '组合名称',edit:'gname'}, |
||||
|
{field: 'code', width: 150, title: '组合编码'}, |
||||
|
{title: '拥有物料', width: 700, align: "center"}, |
||||
|
{field: 'quantity', width: 200, title: '物料数量'}, |
||||
|
{field: 'createTime', width: 200, title: '创建时间'}, |
||||
|
{field: 'state', title: '状态', minWidth: 100, templet: '#switchTpl'}, |
||||
|
{title: '出库', minWidth: 200, toolbar: '#currentTableBarForOut', align: "center"}, |
||||
|
{title: '操作', minWidth: 200, toolbar: '#currentTableBar', align: "center"}, |
||||
|
|
||||
|
|
||||
|
] |
||||
|
], |
||||
|
limits: [10, 15, 20, 25, 50, 100], |
||||
|
limit: 10, |
||||
|
page: true, |
||||
|
skin: 'line', |
||||
|
done: function (res, curr, count) { |
||||
|
$.each(res['data'], function (i, j) { |
||||
|
let materialSimple = j["materialSimple"]; |
||||
|
let gid = j["id"]; |
||||
|
let keys = Object.keys(materialSimple); |
||||
|
var materialItem = $("[lay-id='currentTableId'] tr:eq(" + (i+1) + ")").children()[3]; |
||||
|
var aItem = materialItem.childNodes[0]; |
||||
|
for (let k = 0; k < keys.length; k++) { |
||||
|
$(aItem).append('<button id='+ gid+' class="layui-btn layui-btn-primary layui-btn-xs" onclick="checkSeeGroup(this)" value='+materialSimple[keys[k]]+'>'+keys[k]+'</button>') |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
// 监听搜索操作 |
||||
|
form.on('submit(data-search-btn)', function (data) { |
||||
|
var req = {}; |
||||
|
data = data.field; |
||||
|
if (data.code !== '') { |
||||
|
req.code = data.code; |
||||
|
} |
||||
|
if(data.createTime !== ''){ |
||||
|
req.createTime = data.createTime; |
||||
|
} |
||||
|
if(data.state !== ''){ |
||||
|
req.state = data.state; |
||||
|
} |
||||
|
if(data.name !== ''){ |
||||
|
req.gname = data.name; |
||||
|
} |
||||
|
|
||||
|
//执行搜索重载 |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/findAllGroup', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
where: req |
||||
|
}, 'data'); |
||||
|
return false; |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
// 用于监视表格编辑 |
||||
|
table.on('edit(currentTableFilter)', function(obj){ //注:edit是固定事件名,test是table原始容器的属性 lay-filter="对应的值" |
||||
|
|
||||
|
let gid = obj.data.id; |
||||
|
let gname = obj.value; |
||||
|
let req = {}; |
||||
|
req.id = gid; |
||||
|
req.gname = gname; |
||||
|
$.ajax({ |
||||
|
url:'/group/editGroupInfo', |
||||
|
dataType:"json", |
||||
|
type:"post", |
||||
|
data:JSON.stringify(req), |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (data) { |
||||
|
if (data.status >= 300) { |
||||
|
layer.msg(data.statusInfo.message);//失败的表情 |
||||
|
|
||||
|
} else { |
||||
|
//执行搜索重载 |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/findAllGroup', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
}, 'data'); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
// 用于监听操作 |
||||
|
table.on('tool(currentTableFilter)', function (obj) { |
||||
|
let data = obj.data; |
||||
|
|
||||
|
if (obj.event === 'detail') { |
||||
|
var index = layer.open({ |
||||
|
title: '组合详情', |
||||
|
type: 2, |
||||
|
shade: 0.2, |
||||
|
maxmin: true, |
||||
|
shadeClose: true, |
||||
|
area: ['100%', '100%'], |
||||
|
content: '/group_edit?id='+data.id, |
||||
|
end:function () { |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/findAllGroup', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
}, 'data'); |
||||
|
} |
||||
|
}); |
||||
|
$(window).on("resize", function () { |
||||
|
layer.full(index); |
||||
|
}); |
||||
|
} |
||||
|
else if (obj.event === 'delete') { |
||||
|
var req = {}; |
||||
|
req.id = data.id; |
||||
|
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { |
||||
|
$.ajax({ |
||||
|
url:"/group/delGroup", |
||||
|
type:"post", |
||||
|
dataType:"json", |
||||
|
data:JSON.stringify(req), |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (data) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (data.status >= 300) { |
||||
|
layer.msg(data.statusInfo.message);//失败的表情 |
||||
|
|
||||
|
} else { |
||||
|
layer.msg("删除成功", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
||||
|
}); |
||||
|
//执行搜索重载 |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/findAllGroup', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
}, 'data'); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}); |
||||
|
} |
||||
|
else if (obj.event === 'realDelete') { //彻底删除 |
||||
|
layer.confirm('该操作将无法挽回', {icon: 2, title: '提示'}, function (index) { |
||||
|
var req = {}; |
||||
|
req.id = data.id; |
||||
|
$.ajax({ |
||||
|
url:"/group/realDelGroup", |
||||
|
type:"post", |
||||
|
dataType:"json", |
||||
|
data:JSON.stringify(req), |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (data) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (data.status >= 300) { |
||||
|
layer.msg(data.statusInfo.message);//失败的表情 |
||||
|
|
||||
|
} else { |
||||
|
layer.msg("删除成功", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
||||
|
}); |
||||
|
//执行搜索重载 |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/findAllGroup', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
}, 'data'); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
} |
||||
|
else if (obj.event === 'applicationOut'){ |
||||
|
let gid = data.id; |
||||
|
|
||||
|
var index1 = layer.open({ |
||||
|
title: '组合出库', |
||||
|
type: 2, |
||||
|
shade: 0.2, |
||||
|
maxmin: true, |
||||
|
shadeClose: true, |
||||
|
area: ['100%', '100%'], |
||||
|
content: '/applicationOutForGroup?gid='+gid+'&type=one', |
||||
|
}); |
||||
|
$(window).on("resize", function () { |
||||
|
layer.full(index1); |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
//用于查看并修改组合中的物料信息 |
||||
|
checkSeeGroup = function (obj) { |
||||
|
let gid = obj.id; |
||||
|
let mid = obj.value; |
||||
|
layer.open({ |
||||
|
type: 2, |
||||
|
title: "组合明细", |
||||
|
skin: 'layui-layer-rim', |
||||
|
maxmin: true, |
||||
|
shadeClose: true, //点击遮罩关闭层 |
||||
|
area: ['100%', '100%'], |
||||
|
move: '.layui-layer-title', |
||||
|
fixed: false, |
||||
|
content: '/materialForGroup?mid='+mid+'&gid='+gid, |
||||
|
end:function () { |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/findAllGroup', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
}, 'data'); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
//监听状态操作 |
||||
|
form.on('switch(changeState)', function (obj) { |
||||
|
var req = new Map; |
||||
|
if (obj.elem.checked) { |
||||
|
req["state"] = 1 |
||||
|
} |
||||
|
req["id"] = this.value; |
||||
|
$.ajax({ |
||||
|
url: "/group/changeGroupState", |
||||
|
type: 'post', |
||||
|
dataType: 'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
data: JSON.stringify(req), |
||||
|
beforeSend: function () { |
||||
|
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); |
||||
|
}, |
||||
|
success: function (data) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (data.status >= 300) { |
||||
|
layer.msg(data.statusInfo.message);//失败的表情 |
||||
|
} else { |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/findAllGroup', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
}, 'data'); |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* toolbar监听事件 |
||||
|
*/ |
||||
|
table.on('toolbar(currentTableFilter)', function (obj) { |
||||
|
if (obj.event === 'add') { // 监听添加操作 |
||||
|
layer.open({ |
||||
|
type: 2, |
||||
|
title: "创建组合", |
||||
|
skin: 'layui-layer-rim', |
||||
|
maxmin: true, |
||||
|
shadeClose: true, //点击遮罩关闭层 |
||||
|
area: ['100%', '100%'], |
||||
|
move: '.layui-layer-title', |
||||
|
fixed: false, |
||||
|
content: '/group_add', |
||||
|
end:function () { |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/findAllGroup', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
}, 'data'); |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
} |
||||
|
else if(obj.event === 'delete') { |
||||
|
var checkStatus = table.checkStatus('currentTableId') |
||||
|
, data = checkStatus.data; |
||||
|
var req = {}; |
||||
|
req.ids = []; |
||||
|
for (i = 0, len = data.length; i < len; i++) { |
||||
|
req.ids[i] = data[i].id; |
||||
|
} |
||||
|
if (req.ids.length > 0) { |
||||
|
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { |
||||
|
$.ajax({ |
||||
|
url:"/group/delGroup", |
||||
|
type:"post", |
||||
|
dataType:"json", |
||||
|
data:JSON.stringify(req), |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (data) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (data.status >= 300) { |
||||
|
layer.msg(data.statusInfo.message);//失败的表情 |
||||
|
|
||||
|
} else { |
||||
|
layer.msg("删除成功", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
||||
|
}); |
||||
|
//执行搜索重载 |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/findAllGroup', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
}, 'data'); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
}else{ |
||||
|
layer.msg("未选中记录,请确认!"); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
else if(obj.event === 'applicationOutAdd'){ |
||||
|
// 如果点击的是添加出库记录 |
||||
|
var checkStatus = table.checkStatus('currentTableId') |
||||
|
, data = checkStatus.data; |
||||
|
var req = {}; |
||||
|
req.gids = []; |
||||
|
for (i = 0, len = data.length; i < len; i++) { |
||||
|
req.gids[i] = data[i].id; |
||||
|
} |
||||
|
if (req.gids.length > 0) { |
||||
|
$.ajax({ |
||||
|
url: "/group/addApplicationToRedis", |
||||
|
type: "post", |
||||
|
data: JSON.stringify(req), |
||||
|
dataType: "json", |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (data) { |
||||
|
if (data.status === 201) { |
||||
|
layer.msg("添加成功", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
||||
|
}, function () { |
||||
|
//执行搜索重载 |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/findAllGroup', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
}, 'data'); |
||||
|
}); |
||||
|
} else { |
||||
|
layer.msg("添加失败,请重试", { |
||||
|
icon: 2, |
||||
|
time: 200, |
||||
|
}, function () { |
||||
|
//执行搜索重载 |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/findAllGroup', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
}, 'data'); |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}else{ |
||||
|
layer.msg("未选中记录,请确认!"); |
||||
|
return false; |
||||
|
} |
||||
|
}else if(obj.event === 'dispose'){ |
||||
|
// 如果点击的是处理 |
||||
|
var index = layer.open({ |
||||
|
title: '处理', |
||||
|
type: 2, |
||||
|
shade: 0.2, |
||||
|
maxmin: true, |
||||
|
shadeClose: true, |
||||
|
area: ['100%', '100%'], |
||||
|
content: '/application_group_multi' |
||||
|
}); |
||||
|
$(window).on("resize", function () { |
||||
|
layer.full(index); |
||||
|
}); |
||||
|
return false; |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
|
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,330 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
||||
|
<head> |
||||
|
<meta charset="utf-8"> |
||||
|
<title>layui</title> |
||||
|
<meta name="renderer" content="webkit"> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
||||
|
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
||||
|
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div class="layuimini-container"> |
||||
|
<div class="layuimini-main"> |
||||
|
<input id="id" th:value="${id}" style="display:none;"> |
||||
|
|
||||
|
<fieldset class="layui-elem-field layui-field-title"> |
||||
|
<legend>基本信息</legend> |
||||
|
<div style="margin: 10px 10px 10px 10px"> |
||||
|
<form class="layui-form layui-form-pane" action=""> |
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">组合名称</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" name="gname" id="gname" placeholder="请输入组合名称" th:value="${record.getGname()}" onblur="editGroupName(this)" |
||||
|
autocomplete="off" class="layui-input"> |
||||
|
<input type="text" name="gid" id="gid" placeholder="请输入组合名称" th:value="${record.getId()}" style="display:none;" |
||||
|
autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">组合编码</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" name="gcode" id="gcode" placeholder="请输入组合编码" th:value="${record.getCode()}" readonly |
||||
|
autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<!-- 二维码生成--> |
||||
|
<div class="layui-form-item" style="display: none"> |
||||
|
<label class="layui-form-label">二维码</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input id="createCode" type="button" class="layui-btn layui-btn-radius layui-btn-normal" onclick="createQrCode()" value="生成二维码"/> |
||||
|
<img id="qrCode" style="display:none;"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
</form> |
||||
|
</div> |
||||
|
</fieldset> |
||||
|
|
||||
|
<script id="toolbarDemo" type="text/html"> |
||||
|
<div class="layui-btn-container"> |
||||
|
<button class="layui-btn layui-btn-normal layui-btn-sm data-add-btn" lay-event="add">添加</button> |
||||
|
<button class="layui-btn layui-btn-danger layui-btn-sm data-delet-btn" lay-event="delete">删除</button> |
||||
|
</div> |
||||
|
</script> |
||||
|
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table> |
||||
|
</div> |
||||
|
</div> |
||||
|
<script type="text/html" id="currentTableBar"> |
||||
|
<a class="layui-btn layui-btn-normal layui-btn-xs data-count-edit" lay-event="detail">详情</a> |
||||
|
<a class="layui-btn layui-btn-xs layui-btn-danger data-count-delete" lay-event="delete">删除</a> |
||||
|
</script> |
||||
|
|
||||
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
||||
|
<script> |
||||
|
// 用于通过编码查询物料 |
||||
|
function selectMaterialByCode(obj) { |
||||
|
} |
||||
|
// 用于点击搜索按钮 |
||||
|
function selectMaterial(obj) { |
||||
|
} |
||||
|
// 用于修改组合名称 |
||||
|
function editGroupName(obj){} |
||||
|
|
||||
|
// 用于创建二维码 |
||||
|
function createQrCode(obj){} |
||||
|
layui.use(['form', 'table'], function () { |
||||
|
var $ = layui.jquery, |
||||
|
form = layui.form, |
||||
|
table = layui.table; |
||||
|
// 加载表格 |
||||
|
|
||||
|
let id = $("#id").val(); |
||||
|
table.render({ |
||||
|
elem: "#currentTableId", |
||||
|
url: '/group/findGroupInfo', |
||||
|
parseData: function (res) { //res 即为原始返回的数据 |
||||
|
return { |
||||
|
"status": res.status, //解析接口状态 |
||||
|
"message": res.statusInfo.message, //解析提示文本 |
||||
|
"count": res.count, //解析数据长度 |
||||
|
"data": res.data //解析数据列表 |
||||
|
}; |
||||
|
}, |
||||
|
request: { |
||||
|
pageName: 'page', //页码的参数名称,默认:page |
||||
|
limitName: 'size' //每页数据量的参数名,默认:limit |
||||
|
}, |
||||
|
where: {gid:id}, |
||||
|
response: { |
||||
|
statusName: 'status' //规定数据状态的字段名称,默认:code |
||||
|
, statusCode: 200 //规定成功的状态码,默认:0 |
||||
|
, msgName: 'message' //规定状态信息的字段名称,默认:msg |
||||
|
, countName: 'count' //规定数据总数的字段名称,默认:count |
||||
|
, dataName: 'data' //规定数据列表的字段名称,默认:data |
||||
|
}, |
||||
|
toolbar: '#toolbarDemo', |
||||
|
cols: [ |
||||
|
[ |
||||
|
{type: "checkbox", width: 50}, |
||||
|
{field: 'mcode', width: 150, title: '存货编码', sort: true}, |
||||
|
{field: 'mname', width: 120, title: '物料名称', sort: false}, |
||||
|
{field: 'version', width: 200, title: '规格型号', sort: false}, |
||||
|
{field: 'quantity', width: 200, title: '数量'}, |
||||
|
{field: 'tname', width: 150, title: '物料种类'}, |
||||
|
{field: 'texture', width: 100, title: '材质'}, |
||||
|
{field: 'unit', width: 150, title: '计量单位'}, |
||||
|
{field: 'brand', width: 150, title: '品牌'}, |
||||
|
{field: 'shelfLife', width: 150, title: '保质期'}, |
||||
|
{field: 'productionPlace', width: 150, title: '产地'}, |
||||
|
{title: '操作', minWidth: 150, toolbar: '#currentTableBar', align: "center"} |
||||
|
|
||||
|
|
||||
|
] |
||||
|
], |
||||
|
limits: [10, 15, 20, 25, 50, 100], |
||||
|
limit: 10, |
||||
|
page: true, |
||||
|
skin: 'line' |
||||
|
}); |
||||
|
|
||||
|
// 用于监听操作 |
||||
|
table.on('tool(currentTableFilter)', function (obj) { |
||||
|
let data = obj.data; |
||||
|
|
||||
|
if (obj.event === 'detail') { |
||||
|
layer.open({ |
||||
|
type: 2, |
||||
|
title: "物料明细", |
||||
|
skin: 'layui-layer-rim', |
||||
|
maxmin: true, |
||||
|
shadeClose: true, //点击遮罩关闭层 |
||||
|
area: ['100%', '100%'], |
||||
|
move: '.layui-layer-title', |
||||
|
fixed: false, |
||||
|
content: '/materialForGroup?mid='+data.mid+'&gid='+id, |
||||
|
end:function () { |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/findGroupInfo', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
where:{ |
||||
|
gid:id |
||||
|
} |
||||
|
}, 'data'); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
else if (obj.event === 'delete') { |
||||
|
var req = {}; |
||||
|
req.id = data.id; |
||||
|
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { |
||||
|
$.ajax({ |
||||
|
url:"/group/delMaterialForGroup", |
||||
|
type:"post", |
||||
|
dataType:"json", |
||||
|
data:JSON.stringify(req), |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (data) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (data.status >= 300) { |
||||
|
layer.msg(data.statusInfo.message);//失败的表情 |
||||
|
|
||||
|
} else { |
||||
|
layer.msg("删除成功", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
||||
|
}); |
||||
|
//执行搜索重载 |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/findGroupInfo', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
where:{ |
||||
|
gid:id |
||||
|
} |
||||
|
}, 'data'); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
/** |
||||
|
* toolbar监听事件 |
||||
|
*/ |
||||
|
table.on('toolbar(currentTableFilter)', function (obj) { |
||||
|
if (obj.event === 'add') { // 监听添加操作 |
||||
|
layer.open({ |
||||
|
type: 2, |
||||
|
title: "物料明细", |
||||
|
skin: 'layui-layer-rim', |
||||
|
maxmin: true, |
||||
|
shadeClose: true, //点击遮罩关闭层 |
||||
|
area: ['100%', '100%'], |
||||
|
move: '.layui-layer-title', |
||||
|
fixed: false, |
||||
|
content: '/group_add?gid='+id, |
||||
|
end:function () { |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/findGroupInfo', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
where:{ |
||||
|
gid:id |
||||
|
} |
||||
|
}, 'data'); |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
else if(obj.event === 'delete'){ |
||||
|
var checkStatus = table.checkStatus('currentTableId') |
||||
|
, data = checkStatus.data; |
||||
|
var req = {}; |
||||
|
req.ids = []; |
||||
|
for (i = 0, len = data.length; i < len; i++) { |
||||
|
req.ids[i] = data[i].id; |
||||
|
} |
||||
|
if(req.ids.length > 0){ |
||||
|
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { |
||||
|
$.ajax({ |
||||
|
url:"/group/delMaterialForGroup", |
||||
|
type:"post", |
||||
|
dataType:"json", |
||||
|
data:JSON.stringify(req), |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (data) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (data.status >= 300) { |
||||
|
layer.msg(data.statusInfo.message);//失败的表情 |
||||
|
|
||||
|
} else { |
||||
|
layer.msg("删除成功", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
||||
|
}); |
||||
|
//执行搜索重载 |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/group/findGroupInfo', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
where:{ |
||||
|
gid:id |
||||
|
} |
||||
|
}, 'data'); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}); |
||||
|
}else{ |
||||
|
layer.msg("未选中记录,请确认!"); |
||||
|
return false; |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
// 用于修改组合名称 |
||||
|
editGroupName = function (obj) { |
||||
|
let gid = $("#gid").val(); |
||||
|
let gname = obj.value; |
||||
|
let req = {}; |
||||
|
req.id = gid; |
||||
|
req.gname = gname; |
||||
|
$.ajax({ |
||||
|
url:'/group/editGroupInfo', |
||||
|
dataType:"json", |
||||
|
type:"post", |
||||
|
data:JSON.stringify(req), |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (data) { |
||||
|
if (data.status >= 300) { |
||||
|
layer.msg(data.statusInfo.message);//失败的表情 |
||||
|
|
||||
|
} else { |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
// 用于创建二维码 |
||||
|
createQrCode = function () { |
||||
|
var gid = $("#gid").val(); |
||||
|
var req = {}; |
||||
|
req.gid = gid; |
||||
|
$.ajax({ |
||||
|
url: "/group/createQrCode", |
||||
|
type: 'post', |
||||
|
dataType: 'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
data: JSON.stringify(req), |
||||
|
beforeSend: function () { |
||||
|
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); |
||||
|
}, |
||||
|
success: function (d) { |
||||
|
var data = d.data; |
||||
|
layer.close(this.layerIndex); |
||||
|
$("#qrCode").attr("src",data); |
||||
|
$("#qrCode").show(); |
||||
|
$("#createCode").hide(); |
||||
|
} |
||||
|
}) |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,148 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
||||
|
<head> |
||||
|
<meta charset="utf-8"> |
||||
|
<title>layui</title> |
||||
|
<meta name="renderer" content="webkit"> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
||||
|
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
||||
|
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
||||
|
</head> |
||||
|
<body> |
||||
|
<form class="layui-form layui-form-pane" action=""> |
||||
|
<input type="text" id="id" name="id" th:value="${record.getId()}" style="display:none;"> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">组合编码</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" th:value="${record.getGcode()}" name="gcode" required lay-verify="required" readonly |
||||
|
autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">物料编号</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input id="mcode" type="text" th:value="${record.getMcode()}" name="mcode" required lay-verify="required" autocomplete="off" |
||||
|
class="layui-input" onblur="selectMaterialByCode(this)" readonly="readonly"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">物料名称</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" th:value="${record.getMname()}" name="mname" required lay-verify="required" readonly |
||||
|
autocomplete="off" class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">规格型号</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" th:value="${record.getVersion()}" name="version" autocomplete="off" readonly |
||||
|
class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">物料数量</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" th:value="${record.getQuantity()}" name="quantity" autocomplete="off" |
||||
|
class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">品牌:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" placeholder="请填写物料品牌" class="layui-input" th:value="${record.getBrand()}" readonly |
||||
|
name="brand"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">物料类型</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" class="layui-input" id="openSonByMateralType" readonly |
||||
|
th:value="${record.getTname()}" |
||||
|
lay-verify="required"/> |
||||
|
<input type="text" id="materialTypeId" th:value="${record.getMtid()}" |
||||
|
name="materialTypeId" class="layui-input" style="display: none" lay-verify="required"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">材质</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" th:value="${record.getTexture()}" name="texture" autocomplete="off" readonly |
||||
|
class="layui-input"> |
||||
|
|
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">计量单位</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" th:value="${record.getUnit()}" name="unit" required autocomplete="off" readonly |
||||
|
class="layui-input"> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">备注:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" placeholder="请填写备注" class="layui-input" th:value="${record.getRemark()}" |
||||
|
name="remark" /> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-input-block"> |
||||
|
<button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button> |
||||
|
<button type="reset" class="layui-btn layui-btn-primary">重置</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
||||
|
<script> |
||||
|
// 用于通过编码查询物料 |
||||
|
function selectMaterialByCode(obj) { |
||||
|
} |
||||
|
// 用于点击搜索按钮 |
||||
|
function selectMaterial(obj) { |
||||
|
} |
||||
|
layui.use(['form'], function () { |
||||
|
var form = layui.form, $ = layui.$; |
||||
|
let id = $("#id").val(); |
||||
|
form.on('submit(formDemo)', function (data) { |
||||
|
data = data.field; |
||||
|
data.id = id; |
||||
|
$.ajax({ |
||||
|
url: "/group/materialForGroupEdit", |
||||
|
type: 'post', |
||||
|
dataType: 'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
data: JSON.stringify(data), |
||||
|
beforeSend: function () { |
||||
|
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); |
||||
|
}, |
||||
|
success: function (data) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (data.status >= 300) { |
||||
|
layer.msg(data.statusInfo.message);//失败的表情 |
||||
|
return; |
||||
|
} else { |
||||
|
layer.msg("修改成功", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
||||
|
}, function () { |
||||
|
var index = parent.layer.getFrameIndex(window.name); |
||||
|
parent.layer.close(index);//关闭当前页 |
||||
|
window.location = '/group_out' |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
return false; |
||||
|
}); |
||||
|
|
||||
|
}) |
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,85 @@ |
|||||
|
<!DOCTYPE html> |
||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org"> |
||||
|
<head> |
||||
|
<meta charset="utf-8"> |
||||
|
<title>layui</title> |
||||
|
<meta name="renderer" content="webkit"> |
||||
|
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> |
||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1"> |
||||
|
<link rel="stylesheet" href="/static/lib/layui-v2.6.3/css/layui.css" media="all"> |
||||
|
<link rel="stylesheet" href="/static/css/public.css" media="all"> |
||||
|
</head> |
||||
|
<body> |
||||
|
<div id="test2" class="demo-tree"></div> |
||||
|
<input id="gname" name="gname" th:value="${gname}" style="display: none"> |
||||
|
<input id="clickObj" name="clickObj" th:value="${clickObj}" style="display: none"> |
||||
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
||||
|
<script> |
||||
|
layui.use(['form', 'layer', 'dropdown', 'tree'], function () { |
||||
|
var $ = layui.jquery, |
||||
|
tree = layui.tree; |
||||
|
var gname = $("#gname").val(); |
||||
|
var clickObj = $("#clickObj").val(); |
||||
|
|
||||
|
|
||||
|
|
||||
|
// 用于暂存当前查询结果 |
||||
|
var tempData = []; |
||||
|
var req = {}; |
||||
|
req.gname = gname; |
||||
|
var test = tree.render({ |
||||
|
elem: '#test2' |
||||
|
, data: [] |
||||
|
, click: function (obj) { |
||||
|
let data = obj.data; |
||||
|
if(data.children === undefined){ |
||||
|
return false; |
||||
|
}else{ |
||||
|
var windowParent = $("#"+clickObj,window.parent.document)[0]; |
||||
|
var parentId = windowParent.id; |
||||
|
// 获取对应元素 |
||||
|
var pid = Number(windowParent.id.split("cardItemForGroup")[1]); |
||||
|
|
||||
|
// 获取当前卡片中的组合名称等 |
||||
|
let gnameParent = windowParent.childNodes[5].childNodes[3]; |
||||
|
|
||||
|
// 组合编码 |
||||
|
let gcodeItem = windowParent.childNodes[7].childNodes[3].childNodes[1].childNodes[1]; |
||||
|
|
||||
|
|
||||
|
// gid |
||||
|
let gidItem = gnameParent.childNodes[3]; |
||||
|
|
||||
|
// gname |
||||
|
let gnameItem = gnameParent.childNodes[1].childNodes[1]; |
||||
|
|
||||
|
gnameItem.value = data.title; |
||||
|
gidItem.value = data.id; |
||||
|
var index = parent.layer.getFrameIndex(window.name); |
||||
|
parent.layer.close(index); |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
$.ajax({ |
||||
|
url: "/group/treeMenus", |
||||
|
data: JSON.stringify(req), |
||||
|
type: 'post', |
||||
|
dataType: 'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
tempData = d.data; |
||||
|
test.reload({ |
||||
|
data: tempData |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
|
||||
|
}) |
||||
|
</script> |
||||
|
</body> |
||||
|
</html> |
||||
Loading…
Reference in new issue