You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
326 lines
12 KiB
326 lines
12 KiB
<!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.8.6/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">
|
|
<link rel="stylesheet" href="/static/lib/font-awesome-4.7.0/css/font-awesome.min.css" media="all">
|
|
|
|
|
|
<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;
|
|
}
|
|
|
|
.inputdiv .layui-unselect {
|
|
border-style: none;
|
|
}
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<form class="layui-form layui-form-pane" action="">
|
|
|
|
<input type="text" id="barCodeList" style="display:none;">
|
|
<div class="layui-form-item" style="display: none">
|
|
<label class="layui-form-label">物料编号</label>
|
|
<div class="layui-input-block">
|
|
<input id="mid" type="text" th:value="${record.getId()}" name="id" required lay-verify="required"
|
|
autocomplete="off"
|
|
class="layui-input" 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" id="mname"
|
|
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.getCode()}" name="code" required lay-verify="required" id="code"
|
|
autocomplete="off" class="layui-input" 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.getVersion()}" name="version" autocomplete="off" id="version"
|
|
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()}" id="brand"
|
|
name="brand"/>
|
|
</div>
|
|
</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" id="openSonByMateralType" readonly
|
|
th:value="${record.getMaterialType().getTname()}"
|
|
lay-verify="required"/>
|
|
<input type="text" id="materialTypeId" th:value="${record.getMaterialTypeId()}" placeholder="请选择物料类型"
|
|
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" id="texture"
|
|
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" id="unit"
|
|
class="layui-input">
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item" id="priceItem" th:style="'display:'+${display}">
|
|
<label class="layui-form-label">单价</label>
|
|
<div class="layui-input-inline">
|
|
<input type="text" th:value="${record.getPrice()}" name="price" required autocomplete="off"
|
|
class="layui-input">
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label" style="height: 40px;">保质期:</label>
|
|
<div class="layui-input-inline">
|
|
<div class="inputdiv">
|
|
<input type="number" name="shelfLife" id="shelfLife" placeholder="请填写保质日期" autocomplete="off"
|
|
th:value="${record.getShelfLife()}"
|
|
class="layui-input" style="border-style: none">
|
|
<select id="dateType" name="dateType">
|
|
<option value="year" th:selected="${record.getShowShelfLife() == 'year'}">年</option>
|
|
<option value="month" th:selected="${record.getShowShelfLife() == 'month'}">月</option>
|
|
<option value="day" th:selected="${record.getShowShelfLife() == 'day'}">日</option>
|
|
</select>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- 二维码生成-->
|
|
<div class="layui-form-item">
|
|
<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="生成"/>
|
|
<div id="codeItem" style="display:none;">
|
|
<img id="barCode">
|
|
<button id="printer" type="button" onclick="print_code()" class="layui-btn">打印</button>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item">
|
|
<label class="layui-form-label">条形码</label>
|
|
<div class="layui-input-block">
|
|
<input class="layui-btn layui-btn-warm" type="button" onclick="checkBarCode()" value="查看">
|
|
</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()}" id="remark"
|
|
name="remark"/>
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item" style="display: none">
|
|
<label class="layui-form-label">状态</label>
|
|
<div class="layui-input-block">
|
|
<input type="checkbox" name="state" lay-skin="switch" lay-text="启用|禁用"
|
|
th:checked="${record.getState() == 1}">
|
|
</div>
|
|
</div>
|
|
<div class="layui-form-item" id="btn_sb">
|
|
<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.8.6/layui.js" charset="utf-8"></script>
|
|
<script>
|
|
function changeQrCodeState() {
|
|
}
|
|
|
|
function createQrCode() {
|
|
|
|
}
|
|
|
|
function checkBarCode() {
|
|
|
|
}
|
|
|
|
function print_code() {
|
|
|
|
}
|
|
|
|
// 用于标志是否为第一次提交
|
|
let flagForForm = false;
|
|
var barCode = [];
|
|
var flag = false;
|
|
layui.use(['form', 'laydate'], function () {
|
|
var form = layui.form, laydate = layui.laydate, $ = layui.$;
|
|
|
|
let display = $("#priceItem").css("display");
|
|
if (display === "none") {
|
|
$("#mname").attr("readonly", "readonly");
|
|
$("#code").attr("readonly", "readonly");
|
|
$("#version").attr("readonly", "readonly");
|
|
$("#brand").attr("readonly", "readonly");
|
|
$("#texture").attr("readonly", "readonly");
|
|
$("#unit").attr("readonly", "readonly");
|
|
$("#shelfLife").attr("readonly", "readonly");
|
|
$("#remark").attr("readonly", "readonly");
|
|
$("#btn_sb").css("display", "none");
|
|
$("#openSonByMateralType").off("click");
|
|
}
|
|
|
|
$('#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%');
|
|
}
|
|
});
|
|
});
|
|
//提交
|
|
form.on('submit(formDemo)', function (data) {
|
|
if (!flagForForm) {
|
|
flagForForm = true;
|
|
data = data.field;
|
|
if (flag) {
|
|
data.barCodeList = barCode;
|
|
}
|
|
$.ajax({
|
|
url: "/material/material_edit",
|
|
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 = '/material_out'
|
|
})
|
|
}
|
|
}
|
|
});
|
|
}
|
|
|
|
return false;
|
|
});
|
|
|
|
|
|
checkBarCode = function () {
|
|
var mid = $("#mid").val();
|
|
layer.open({
|
|
type: 2,
|
|
title: '详情',
|
|
skin: 'layui-layer-rim',
|
|
maxmin: true,
|
|
shadeClose: true, //点击遮罩关闭层
|
|
area: ['100%', '100%'],
|
|
move: '.layui-layer-title',
|
|
fixed: false,
|
|
content: '/checkBarCode?mid=' + mid,
|
|
|
|
})
|
|
};
|
|
|
|
print_code = function () {
|
|
layer.open({
|
|
type: 2,
|
|
title: '打印',
|
|
skin: 'layui-layer-rim',
|
|
maxmin: true,
|
|
shadeClose: true, //点击遮罩关闭层
|
|
area: ['70%', '70%'],
|
|
move: '.layui-layer-title',
|
|
fixed: false,
|
|
content: '/printCode?mid=' + $("#mid").val() + '&flag=1',
|
|
|
|
})
|
|
};
|
|
|
|
createQrCode = function () {
|
|
var mid = $("#mid").val();
|
|
var req = {};
|
|
req.mid = mid;
|
|
$.ajax({
|
|
url: "/material/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);
|
|
$("#barCode").attr("src", data.qrCode);
|
|
$("#codeItem").show();
|
|
$("#createCode").hide();
|
|
}
|
|
})
|
|
}
|
|
|
|
|
|
});
|
|
</script>
|
|
|
|
</body>
|
|
</html>
|