|
|
|
|
<!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>
|
|
|
|
|
<form class="layui-form layui-form-pane" action="">
|
|
|
|
|
<div class="layui-form-item" style="display: none">
|
|
|
|
|
<label class="layui-form-label">仓库编号</label>
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<input type="text" th:value="${record.getId()}" id="did" 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-block">
|
|
|
|
|
<input type="text" th:value="${record.getCode()}" name="code" autocomplete="off" class="layui-input"
|
|
|
|
|
readonly="readonly">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label">仓库名称</label>
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<input type="text" id="dname" th:value="${record.getDname()}" name="dname" required lay-verify="required"
|
|
|
|
|
autocomplete="off" class="layui-input">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label">所处公司</label>
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<select name="cid" th:value="${record.getCid()}" lay-verify="required" lay-filter="company">
|
|
|
|
|
<option value="">请选择公司</option>
|
|
|
|
|
<option th:each="administrationP,iterStar:${administrationPList}" th:value="${administrationP?.getId()}"
|
|
|
|
|
th:text="${administrationP?.getName()}"
|
|
|
|
|
th:selected="${record.getCid() == administrationP.getId()}">外芯仓库
|
|
|
|
|
</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label">部门</label>
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<select name="adminorg" id="adminorg" lay-verify="required">
|
|
|
|
|
<option value="">请选择部门</option>
|
|
|
|
|
<option th:each="post,iterStar:${postList}" th:text="${post?.getName()}" th:value="${post?.getId()}"
|
|
|
|
|
th:selected="${record.getAdminorg().equals(post.getId().toString())}"></option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label">仓库地址</label>
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<input type="text" th:value="${record.getAddress()}" name="address" autocomplete="off" class="layui-input">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label">仓库介绍</label>
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<input type="text" th:value="${record.getIntroduce()}" name="introduce" autocomplete="off"
|
|
|
|
|
class="layui-input">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label">父级仓库:</label>
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<select name="parentId">
|
|
|
|
|
<option value="0">请选择仓库</option>
|
|
|
|
|
<option th:each="depository,iterStar:${depositories}" th:value="${depository?.getId()}"
|
|
|
|
|
th:text="${depository?.getDname()}" th:selected="${depository.getId() == record.getParentId()}">
|
|
|
|
|
顶级公司
|
|
|
|
|
</option>
|
|
|
|
|
</select>
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label">最大存储量</label>
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<input type="text" th:value="${record.getMaxNumber()}" name="maxNumber" required lay-verify="required"
|
|
|
|
|
autocomplete="off" class="layui-input">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label">最小存储量</label>
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<input type="text" th:value="${record.getMinNumber()}" name="minNumber" required lay-verify="required"
|
|
|
|
|
autocomplete="off" class="layui-input">
|
|
|
|
|
</div>
|
|
|
|
|
</div>
|
|
|
|
|
<div class="layui-form-item">
|
|
|
|
|
<label class="layui-form-label">打印码</label>
|
|
|
|
|
<div class="layui-input-block">
|
|
|
|
|
<div id="codeItem" style="display:none;">
|
|
|
|
|
<img id="barCode">
|
|
|
|
|
<!-- <u id="barCodeValue"></u>-->
|
|
|
|
|
<br>
|
|
|
|
|
<button id="printer" type="button" onclick="print_code()" class="layui-btn">打印</button>
|
|
|
|
|
<a id="downloadImg" type="button" onclick="downloadCodeImg()" class="layui-btn">导出图片</a>
|
|
|
|
|
</div>
|
|
|
|
|
<input id="createCode" type="button" class="layui-btn layui-btn-radius layui-btn-normal"
|
|
|
|
|
onclick="createQrCode()" value="生成"/>
|
|
|
|
|
</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">
|
|
|
|
|
<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 createQrCode() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function downloadCodeImg() {
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
// 用于标志是否为第一次提交
|
|
|
|
|
let flagForForm = false;
|
|
|
|
|
|
|
|
|
|
layui.use('form', function () {
|
|
|
|
|
var form = layui.form, $ = layui.$;
|
|
|
|
|
|
|
|
|
|
form.on('select(company)', function (data) {
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "/repository/findPostByCompany?company=0" + data.value,
|
|
|
|
|
type: 'get',
|
|
|
|
|
dataType: 'json',
|
|
|
|
|
contentType: "application/json;charset=utf-8",
|
|
|
|
|
success: function (d) {
|
|
|
|
|
if (data.value !== "") {
|
|
|
|
|
$('#adminorg').empty();
|
|
|
|
|
$('#adminorg').append(new Option("请选择部门", ""));
|
|
|
|
|
$.each(d.data, function (index, item) {
|
|
|
|
|
$('#adminorg').append(new Option(item.name, item.id));//往下拉菜单里添加元素
|
|
|
|
|
});
|
|
|
|
|
form.render();
|
|
|
|
|
} else {
|
|
|
|
|
$('#adminorg').empty();
|
|
|
|
|
form.render();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
//提交
|
|
|
|
|
form.on('submit(formDemo)', function (data) {
|
|
|
|
|
if(!flagForForm){
|
|
|
|
|
data = data.field;
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "/repository/depository_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 = '/depository-out'
|
|
|
|
|
})
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return false;
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
createQrCode = function () {
|
|
|
|
|
var depositoryId = $("#did").val();
|
|
|
|
|
var req = {};
|
|
|
|
|
req.depositoryId = depositoryId;
|
|
|
|
|
$.ajax({
|
|
|
|
|
url: "/repository/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);
|
|
|
|
|
$("#barCodeValue").text(data.codeValue);
|
|
|
|
|
$("#codeItem").show();
|
|
|
|
|
$("#createCode").hide();
|
|
|
|
|
}
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
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=' + $("#did").val() + '&flag=2',
|
|
|
|
|
|
|
|
|
|
})
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*downloadCodeImg = function() { //下载base64图片
|
|
|
|
|
let imgCode = $("#barCode").attr("src");
|
|
|
|
|
let aLink = document.createElement('a');
|
|
|
|
|
let blob = base64ToBlob(imgCode); //new Blob([content]);
|
|
|
|
|
let evt = document.createEvent("HTMLEvents");
|
|
|
|
|
evt.initEvent("click", true, true); //initEvent 不加后两个参数在FF下会报错 事件类型,是否冒泡,是否阻止浏览器的默认行为
|
|
|
|
|
aLink.download = $("#dname").val();
|
|
|
|
|
aLink.href = URL.createObjectURL(blob);
|
|
|
|
|
aLink.click();
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
base64ToBlob = function (code) {
|
|
|
|
|
let parts = code.split(';base64,');
|
|
|
|
|
let contentType = parts[0].split(':')[1];
|
|
|
|
|
let raw = window.atob(parts[1]);
|
|
|
|
|
let rawLength = raw.length;
|
|
|
|
|
let uInt8Array = new Uint8Array(rawLength);
|
|
|
|
|
for (let i = 0; i < rawLength; ++i) {
|
|
|
|
|
uInt8Array[i] = raw.charCodeAt(i);
|
|
|
|
|
}
|
|
|
|
|
return new Blob([uInt8Array], {
|
|
|
|
|
type: contentType
|
|
|
|
|
});
|
|
|
|
|
};*/
|
|
|
|
|
|
|
|
|
|
downloadCodeImg = function () {
|
|
|
|
|
let id = $("#did").val();
|
|
|
|
|
window.open("/repository/allBarCodeImgForDepository?id="+id,"_self");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
});
|
|
|
|
|
</script>
|
|
|
|
|
|
|
|
|
|
</body>
|
|
|
|
|
</html>
|