3 changed files with 1316 additions and 0 deletions
@ -0,0 +1,414 @@ |
|||||
|
<!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"> |
||||
|
<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" class="layui-input" id="mname" name="mname" autocomplete="off"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">物料编码:</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<input type="text" class="layui-input" id="mcode" name="mcode" autocomplete="off"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="layui-inline"> |
||||
|
<label class="layui-form-label">状态</label> |
||||
|
<div class="layui-input-inline"> |
||||
|
<select name="state"> |
||||
|
<option value="">请选择状态</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="sstate" value="{{d.id}}" lay-skin="switch" lay-text="启用|禁用" |
||||
|
lay-filter="changeState" {{ d.sstate== 1 ? 'checked' : '' }} > |
||||
|
</script> |
||||
|
|
||||
|
<script type="text/html" id="toolbarDemo"> |
||||
|
<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-sm layui-btn-danger data-delete-btn" lay-event="delete"> 删除</button> |
||||
|
</div> |
||||
|
</script> |
||||
|
|
||||
|
<table class="layui-hide" id="currentTableId" lay-filter="currentTableFilter"></table> |
||||
|
|
||||
|
<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> |
||||
|
</div> |
||||
|
</div> |
||||
|
<script src="/static/lib/layui-v2.6.3/layui.js" charset="utf-8"></script> |
||||
|
<script> |
||||
|
layui.use(['form', 'table'], function () { |
||||
|
var $ = layui.jquery, |
||||
|
form = layui.form, |
||||
|
table = layui.table; |
||||
|
|
||||
|
|
||||
|
table.render({ |
||||
|
elem: "#currentTableId", |
||||
|
url: '/split/split_out', |
||||
|
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: { |
||||
|
type: "0" |
||||
|
}, |
||||
|
response: { |
||||
|
statusName: 'status' //规定数据状态的字段名称,默认:code |
||||
|
, statusCode: 200 //规定成功的状态码,默认:0 |
||||
|
, msgName: 'message' //规定状态信息的字段名称,默认:msg |
||||
|
, countName: 'count' //规定数据总数的字段名称,默认:count |
||||
|
, dataName: 'data' //规定数据列表的字段名称,默认:data |
||||
|
}, |
||||
|
toolbar: '#toolbarDemo', |
||||
|
defaultToolbar: ['filter', 'exports', 'print'], |
||||
|
cols: [ |
||||
|
[ |
||||
|
{type: "checkbox", width: 50}, |
||||
|
{field: 'mcode', width: 150, title: '存货编码', sort: true}, |
||||
|
{field: 'mname', width: 120, title: '物料名称', sort: false}, |
||||
|
{field: 'typeName', width: 150, title: '物料种类'}, |
||||
|
{field: 'version', width: 200, title: '规格型号', sort: false}, |
||||
|
{field: 'oldUnit', width: 200, title: '旧单位', sort: false}, |
||||
|
{field: 'newUnit', width: 200, title: '新单位', sort: false}, |
||||
|
{field: 'quantity', width: 200, title: '对应数量', sort: false}, |
||||
|
{field: 'texture', width: 100, title: '材质'}, |
||||
|
{field: 'brand', width: 150, title: '品牌'}, |
||||
|
{field: 'shelfLife', width: 150, title: '保质期'}, |
||||
|
{field: 'productionPlace', width: 150, title: '产地'}, |
||||
|
{field: 'remark', width: 150, title: '备注'}, |
||||
|
{field: 'sstate', title: '状态', minWidth: 80, templet: '#switchTpl'}, |
||||
|
{title: '操作', minWidth: 200, toolbar: '#currentTableBar', align: "center"} |
||||
|
] |
||||
|
], |
||||
|
limits: [10, 15, 20, 25, 50,100], |
||||
|
limit: 10, |
||||
|
page: true, |
||||
|
skin: 'line', |
||||
|
done: function () { |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
|
||||
|
|
||||
|
// 监听搜索操作 |
||||
|
form.on('submit(data-search-btn)', function (data) { |
||||
|
var req = {}; |
||||
|
data = data.field; |
||||
|
if (data.mname !== '') { |
||||
|
req.mname = data.mname; |
||||
|
} |
||||
|
if (data.state !== '') { |
||||
|
req.sstate = data.state; |
||||
|
} |
||||
|
if (data.mcode !== '') { |
||||
|
req.mcode = data.mcode |
||||
|
} |
||||
|
|
||||
|
//执行搜索重载 |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/split/split_out', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
where: req |
||||
|
}, 'data'); |
||||
|
return false; |
||||
|
}); |
||||
|
|
||||
|
/** |
||||
|
* toolbar监听事件 |
||||
|
*/ |
||||
|
table.on('toolbar(currentTableFilter)', function (obj) { |
||||
|
if (obj.event === 'add') { // 监听添加操作 |
||||
|
var index = layer.open({ |
||||
|
title: '拆单', |
||||
|
type: 2, |
||||
|
shade: 0.2, |
||||
|
maxmin: true, |
||||
|
shadeClose: true, |
||||
|
area: ['100%', '100%'], |
||||
|
content: '/split_add', |
||||
|
}); |
||||
|
$(window).on("resize", function () { |
||||
|
layer.full(index); |
||||
|
}); |
||||
|
} 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: '/split/split_del', |
||||
|
dataType: 'json', |
||||
|
type: 'POST', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
data: JSON.stringify(req), |
||||
|
beforeSend: function () { |
||||
|
this.layerIndex = layer.load(0, {shade: [0.5, '#393D49']}); |
||||
|
}, |
||||
|
success: function (res) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (res.status >= 300) { |
||||
|
let data = res.data; |
||||
|
if(data === ""){ |
||||
|
layer.msg(data.statusInfo.detail,{ |
||||
|
icon:5, |
||||
|
time:1000 |
||||
|
},function () { |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/split/split_out', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
} |
||||
|
}, 'data'); |
||||
|
return false; |
||||
|
}) |
||||
|
}else{ |
||||
|
let outMessage =''; |
||||
|
for (let i = 0; i < data.length; i++) { |
||||
|
let d = data[i]; |
||||
|
outMessage += d.mname+"," |
||||
|
} |
||||
|
outMessage +='的拆单正在使用中,不允许进行删除操作'; |
||||
|
layer.msg(outMessage,{ |
||||
|
icon:0, |
||||
|
time:1000 |
||||
|
},function () { |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/split/split_out', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
} |
||||
|
}, 'data'); |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
else { |
||||
|
layer.msg("删除成功", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
||||
|
}); |
||||
|
//执行搜索重载 |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/split/split_out', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
} |
||||
|
}, 'data'); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}) |
||||
|
} else { |
||||
|
layer.msg("未选中记录,请确认!"); |
||||
|
return false; |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}); |
||||
|
|
||||
|
|
||||
|
//监听表格复选框选择 |
||||
|
table.on('checkbox(currentTableFilter)', function (obj) { |
||||
|
console.log(obj) |
||||
|
}); |
||||
|
|
||||
|
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: '/split_edit?id=' + data.id, |
||||
|
end: function () { |
||||
|
//执行搜索重载 |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/split/split_out', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
} |
||||
|
}, 'data'); |
||||
|
} |
||||
|
}) |
||||
|
$(window).on("resize", function () { |
||||
|
layer.full(index); |
||||
|
}); |
||||
|
return false; |
||||
|
} else if (obj.event === 'delete') { |
||||
|
var req = {}; |
||||
|
req.id = data.id; |
||||
|
layer.confirm('真的删除么', {icon: 2, title: '提示'}, function (index) { |
||||
|
$.ajax({ |
||||
|
url: '/split/split_del', |
||||
|
dataType: 'json', |
||||
|
type: 'POST', |
||||
|
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.detail,{ |
||||
|
icon:0, |
||||
|
time:1000 |
||||
|
});//失败的表情 |
||||
|
|
||||
|
} else { |
||||
|
obj.del(); |
||||
|
layer.msg("删除成功", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 1000 //1秒关闭(如果不配置,默认是3秒) |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}); |
||||
|
} else if (obj.event === 'realDelete') { //彻底删除 |
||||
|
var req = {}; |
||||
|
req.id = data.id; |
||||
|
layer.confirm('该操作会造成不可逆后果,是否继续?', { |
||||
|
btn: ['继续', '取消'] //按钮 |
||||
|
}, function () { |
||||
|
$.ajax({ |
||||
|
url: '/split/realDeleteSplit', |
||||
|
dataType: 'json', |
||||
|
type: 'POST', |
||||
|
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,{ |
||||
|
icon:0, |
||||
|
time:1000 |
||||
|
},function () { |
||||
|
return false |
||||
|
});//失败的表情 |
||||
|
|
||||
|
} else { |
||||
|
obj.del(); |
||||
|
layer.msg("删除成功", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}, function () { |
||||
|
// 执行重加载 |
||||
|
table.reload('currentTableId', { |
||||
|
url: '/split/split_out', |
||||
|
page: { |
||||
|
curr: 1 |
||||
|
}, |
||||
|
where: {"parentId": parentId} |
||||
|
}); |
||||
|
}); |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
//监听状态操作 |
||||
|
form.on('switch(changeState)', function (obj) { |
||||
|
var req = new Map; |
||||
|
if (obj.elem.checked) { |
||||
|
req["state"] = 1 |
||||
|
} |
||||
|
req["id"] = this.value; |
||||
|
$.ajax({ |
||||
|
url: "/split/split_edit", |
||||
|
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 { |
||||
|
layer.msg("修改成功", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 500 //1秒关闭(如果不配置,默认是3秒) |
||||
|
}, function () { |
||||
|
window.location = '/split_out' |
||||
|
}) |
||||
|
} |
||||
|
} |
||||
|
}) |
||||
|
}); |
||||
|
}); |
||||
|
</script> |
||||
|
|
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,450 @@ |
|||||
|
<!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-fluid { |
||||
|
padding-left: 0px; |
||||
|
padding-right: 0px; |
||||
|
} |
||||
|
|
||||
|
.inputdiv .layui-unselect { |
||||
|
border-style: none; |
||||
|
width: 100%; |
||||
|
} |
||||
|
</style> |
||||
|
<div class="layuimini-container"> |
||||
|
<div class="layuimini-main"> |
||||
|
<fieldset class="table-search-fieldset" style="padding: 10px 2px 5px;"> |
||||
|
<legend>物料拆单</legend> |
||||
|
<div class="layui-fluid"> |
||||
|
<div class="layui-card"> |
||||
|
<div class="layui-card-body" style="padding-left:0px;padding-right:0px"> |
||||
|
<div> |
||||
|
<form class="layui-form layui-form-pane" |
||||
|
style="margin: 0 auto;max-width: 700px;padding-top: 5px; padding-bottom: 50px" |
||||
|
lay-filter="formStep"> |
||||
|
<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="mname" onblur="selectMaterialByName(this)" |
||||
|
lay-verify="required"/> |
||||
|
<i class="layui-icon layui-icon-search" style="display: inline;" |
||||
|
id="selectMaterial" onclick="selectMaterial(this)"></i> |
||||
|
</div> |
||||
|
<input type="text" name="mid" class="layui-input" id="mid" |
||||
|
style="display: none" lay-verify="required"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">物料编码:</label> |
||||
|
<div class="layui-input-block" style="margin: 0px;"> |
||||
|
<div class="inputdiv"> |
||||
|
<input id="code" name="code" type="text" placeholder="请填写入物料编码" value="" |
||||
|
onblur="selectCode(this)" |
||||
|
class="layui-input" lay-verify="required" |
||||
|
style="border-style: none"> |
||||
|
<img src="/static/images/search.ico" height="16" width="16" |
||||
|
id="qrCodeImg" |
||||
|
style="margin-top: 10px" onclick="scanCode(this)"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">条形编码:</label> |
||||
|
<div class="layui-input-block" style="margin: 0px;"> |
||||
|
<div class="inputdiv"> |
||||
|
<input id="barCode" name="barCode" type="text" readonly |
||||
|
value="" |
||||
|
class="layui-input" |
||||
|
style="border-style: none"> |
||||
|
<img src="/static/images/search.ico" height="16" width="16" |
||||
|
id="barCodeImg" |
||||
|
style="margin-top: 10px" onclick="scanBarCode(this)"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">规格型号:</label> |
||||
|
|
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" name="version" class="layui-input" id="version" readonly/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">物料类型:</label> |
||||
|
|
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" name="typeName" class="layui-input" id="typeName" readonly |
||||
|
lay-verify="required"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">计量单位:</label> |
||||
|
|
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" name="oldUnit" class="layui-input" id="unit" readonly |
||||
|
lay-verify="required"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">拆单单位:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" name="newUnit" class="layui-input" id="newUnit" |
||||
|
lay-verify="required"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">对应数目:</label> |
||||
|
|
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" name="quantity" class="layui-input" id="quantity" |
||||
|
lay-verify="number"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-input-block"> |
||||
|
<button class="layui-btn" type="button" lay-submit lay-filter="formStep"> |
||||
|
 提交  |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</fieldset> |
||||
|
</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 selectMaterialByName() { |
||||
|
} |
||||
|
|
||||
|
// 打开物料选择树 |
||||
|
function selectMaterial() { |
||||
|
} |
||||
|
|
||||
|
// 用于编码查询 |
||||
|
function selectCode(obj) { |
||||
|
} |
||||
|
|
||||
|
// 用于扫描条形码 |
||||
|
function scanBarCode(obj) { |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// 用于扫码入库 |
||||
|
function scanCode(obj) { |
||||
|
} |
||||
|
|
||||
|
layui.use(['form', 'layer'], function () { |
||||
|
var $ = layui.jquery, |
||||
|
form = layui.form, |
||||
|
layer = layui.layer; |
||||
|
form.on('submit(formStep)', function (data) { |
||||
|
data = data.field; |
||||
|
$.ajax({ |
||||
|
url:"/split/splitAdd", |
||||
|
data:JSON.stringify(data), |
||||
|
dataType:"json", |
||||
|
type:"post", |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success:function (res) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (data.status >= 300) { |
||||
|
layer.msg(data.statusInfo.detail,{ |
||||
|
icon:6, |
||||
|
time:1000 |
||||
|
},function () { |
||||
|
window.location="/split_add" |
||||
|
});//失败的表情 |
||||
|
} else { |
||||
|
layer.msg("添加成功!", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 1000 |
||||
|
}, //1秒关闭(如果不配置,默认是3秒) |
||||
|
function(){ |
||||
|
//do something |
||||
|
window.location="/split_add" |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
}); |
||||
|
|
||||
|
// 通过名称查询物料 |
||||
|
selectMaterialByName = function (obj) { |
||||
|
let materialName = $("#mname"); |
||||
|
var data = materialName.val(); |
||||
|
var req = {}; |
||||
|
req.mname = data; |
||||
|
let materialId = $("#mid"); |
||||
|
let codeValue = $("#code"); |
||||
|
let version = $("#version"); |
||||
|
let typeName = $("#typeName"); |
||||
|
let unit = $("#unit"); |
||||
|
$.ajax({ |
||||
|
url: "/material/findMaterialByCondition", |
||||
|
type: "post", |
||||
|
dataType: 'json', |
||||
|
data: JSON.stringify(req), |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
if (d.count > 1) { |
||||
|
layer.msg("请点击右侧搜索确定物品"); |
||||
|
materialId.val(""); |
||||
|
codeValue.val(""); |
||||
|
version.val(""); |
||||
|
typeName.val(""); |
||||
|
unit.val(""); |
||||
|
return false; |
||||
|
} else if (d.count === 0) { |
||||
|
layer.msg("没有该物品,请确认输入是否正确"); |
||||
|
materialId.val(""); |
||||
|
codeValue.val(""); |
||||
|
materialName.val(""); |
||||
|
version.val(""); |
||||
|
typeName.val(""); |
||||
|
unit.val(""); |
||||
|
return false; |
||||
|
} else { |
||||
|
var material = d.data[0]; |
||||
|
materialName.val(material.mname); |
||||
|
materialId.val(material.mid); |
||||
|
codeValue.val(material.code); |
||||
|
version.val(material.version); |
||||
|
typeName.val(material.typeName); |
||||
|
unit.val(material.unit); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
// 打开物料选择树 |
||||
|
selectMaterial = function (obj) { |
||||
|
let mname = $("#mname").val(); |
||||
|
mname = mname.split(",")[0]; |
||||
|
layer.open({ |
||||
|
type: 2, |
||||
|
title: '弹窗内容', |
||||
|
skin: 'layui-layer-rim', |
||||
|
maxmin: true, |
||||
|
shadeClose: true, //点击遮罩关闭层 |
||||
|
area: ['70%', '70%'], |
||||
|
content: '/selectMaterial?mname=' + mname, |
||||
|
move: '.layui-layer-title', |
||||
|
fixed: false, |
||||
|
success: function (layero, index) { |
||||
|
let children = layero.children(); |
||||
|
let content = $(children[1]); |
||||
|
let iframeChildren = $(content.children()); |
||||
|
content.css('height', '100%'); |
||||
|
iframeChildren.css('height', '100%'); |
||||
|
}, |
||||
|
end: function () { |
||||
|
var mid = $("#mid").val(); |
||||
|
if (mid !== '') { |
||||
|
$.ajax({ |
||||
|
url: "/material/findMatrialById?mid=" + mid, |
||||
|
type: "get", |
||||
|
dataType: 'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
var material = d.data.materialById; |
||||
|
var code = material.code; |
||||
|
if (code === undefined) { |
||||
|
code = ""; |
||||
|
} |
||||
|
$("#code").val(code); |
||||
|
$("#version").val(material.version); |
||||
|
$("#unit").val(material.unit); |
||||
|
$("#typeName").val(material.typeName); |
||||
|
var materialAndBarCodeList = material["materialAndBarCodeList"]; |
||||
|
if (materialAndBarCodeList.length > 0) { |
||||
|
// 如果有对应的条形码 |
||||
|
$("#barCode").remove(); |
||||
|
var barCodeSelect = ` |
||||
|
<select id="barCode" name= "barCode"></select>`; |
||||
|
$("#barCodeImg").before(barCodeSelect); |
||||
|
form.render(); |
||||
|
$.each(materialAndBarCodeList, function (index, item) { |
||||
|
$("#barCode").append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素 |
||||
|
}); |
||||
|
form.render(); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
scanCodeInStorage = function (obj) { |
||||
|
var objIdNumber = obj.id.split("qrCodeImg")[1]; |
||||
|
parent.wx.scanQRCode({ |
||||
|
desc: 'scanQRCode desc', |
||||
|
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, |
||||
|
scanType: ["qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 |
||||
|
success: function (res) { |
||||
|
// 回调 |
||||
|
var result = res.resultStr;//当needResult为1时返回处理结果 |
||||
|
var req = {}; |
||||
|
req.qrCode = result; |
||||
|
$("#qrCode" + objIdNumber).val(result); |
||||
|
$.ajax({ |
||||
|
url: "/material/qywxApplicationInScanQrCode", |
||||
|
type: "post", |
||||
|
dataType: 'json', |
||||
|
data: JSON.stringify(req), |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
}; |
||||
|
|
||||
|
scanBarCode = function (obj) { |
||||
|
parent.wx.scanQRCode({ |
||||
|
desc: 'scanQRCode desc', |
||||
|
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, |
||||
|
scanType: ["barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 |
||||
|
success: function (res) { |
||||
|
// 回调 |
||||
|
var result = res.resultStr;//当needResult为1时返回处理结果 |
||||
|
var req = {}; |
||||
|
req.qrCode = result; |
||||
|
$.ajax({ |
||||
|
url: "/material/qywxApplicationInScanBarCode", |
||||
|
type: "post", |
||||
|
dataType: 'json', |
||||
|
data: JSON.stringify(req), |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
|
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
error: function (res) { |
||||
|
if (res.errMsg.indexOf('function_not_exist') > 0) { |
||||
|
alert('版本过低请升级') |
||||
|
} |
||||
|
alert(res) |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
// 用于实现通过编码查询物料 |
||||
|
selectCode = function (obj) { |
||||
|
// 输入code |
||||
|
var code = obj.value; |
||||
|
var req = {}; |
||||
|
req.code = code; |
||||
|
req.type = "in"; |
||||
|
$.ajax({ |
||||
|
url: "/material/findMatrialByCode", |
||||
|
type: "get", |
||||
|
dataType: 'json', |
||||
|
data: req, |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
var d = d.data; |
||||
|
if (d == null) { |
||||
|
layer.msg("没有该编码,请确认是否输入正确"); |
||||
|
$("#mname").val(""); |
||||
|
$("#mid").val(""); |
||||
|
$("#code").val(""); |
||||
|
$("#barCode").val(""); |
||||
|
$("#version").val(""); |
||||
|
$("#unit").val(""); |
||||
|
$("#typeName").val(""); |
||||
|
form.render(); |
||||
|
|
||||
|
} else { |
||||
|
$("#mname").val(d.mname); |
||||
|
$("#mid").val( d.mid); |
||||
|
$("#version").val(d.version); |
||||
|
$("#unit").val(d.unit); |
||||
|
$("#typeName").val(d.typeName); |
||||
|
// 获取物料与条形码的对应关系 |
||||
|
var materialAndBarCodeList = d["materialAndBarCodeList"]; |
||||
|
if (materialAndBarCodeList.length > 0) { |
||||
|
// 如果有对应的条形码 |
||||
|
$("#barCode").remove(); |
||||
|
$(".layui-unselect").remove(); |
||||
|
var barCodeSelect = ` |
||||
|
<select id="barCode" name="barCode"> |
||||
|
</select>`; |
||||
|
$("#barCodeImg").before(barCodeSelect); |
||||
|
|
||||
|
form.render(); |
||||
|
$.each(materialAndBarCodeList, function (index, item) { |
||||
|
$("#barCode").append(new Option(item.bmcode, item.bmcode));//往下拉菜单里添加元素 |
||||
|
}); |
||||
|
form.render(); |
||||
|
} else { |
||||
|
$("#barCode").remove(); |
||||
|
$(".layui-unselect").remove(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
}) |
||||
|
</script> |
||||
|
|
||||
|
</body> |
||||
|
</html> |
||||
@ -0,0 +1,452 @@ |
|||||
|
<!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-fluid { |
||||
|
padding-left: 0px; |
||||
|
padding-right: 0px; |
||||
|
} |
||||
|
|
||||
|
.inputdiv .layui-unselect { |
||||
|
border-style: none; |
||||
|
width: 100%; |
||||
|
} |
||||
|
</style> |
||||
|
<div class="layuimini-container"> |
||||
|
<div class="layuimini-main"> |
||||
|
<fieldset class="table-search-fieldset" style="padding: 10px 2px 5px;"> |
||||
|
<legend>物料拆单</legend> |
||||
|
<div class="layui-fluid"> |
||||
|
<div class="layui-card"> |
||||
|
<div class="layui-card-body" style="padding-left:0px;padding-right:0px"> |
||||
|
<div> |
||||
|
<form class="layui-form layui-form-pane" |
||||
|
style="margin: 0 auto;max-width: 700px;padding-top: 5px; padding-bottom: 50px" |
||||
|
lay-filter="formStep"> |
||||
|
<input name="id" style="display: none" id="id" th:value="${record.getId()}"> |
||||
|
<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" th:value="${record.getMname()}" |
||||
|
id="mname" onblur="selectMaterialByName(this)" |
||||
|
lay-verify="required"/> |
||||
|
<i class="layui-icon layui-icon-search" style="display: inline;" |
||||
|
id="selectMaterial" onclick="selectMaterial(this)"></i> |
||||
|
</div> |
||||
|
<input type="text" name="mid" class="layui-input" id="mid" th:value="${record.getMid()}" |
||||
|
style="display: none" lay-verify="required"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">物料编码:</label> |
||||
|
<div class="layui-input-block" style="margin: 0px;"> |
||||
|
<div class="inputdiv"> |
||||
|
<input id="code" name="code" type="text" placeholder="请填写入物料编码" |
||||
|
onblur="selectCode(this)" th:value="${record.getMcode()}" |
||||
|
class="layui-input" lay-verify="required" |
||||
|
style="border-style: none"> |
||||
|
<img src="/static/images/search.ico" height="16" width="16" |
||||
|
id="qrCodeImg" |
||||
|
style="margin-top: 10px" onclick="scanCode(this)"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">条形编码:</label> |
||||
|
<div class="layui-input-block" style="margin: 0px;"> |
||||
|
<div class="inputdiv"> |
||||
|
<input id="barCode" name="barCode" type="text" readonly |
||||
|
class="layui-input" |
||||
|
style="border-style: none"> |
||||
|
<img src="/static/images/search.ico" height="16" width="16" |
||||
|
id="barCodeImg" |
||||
|
style="margin-top: 10px" onclick="scanBarCode(this)"> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">规格型号:</label> |
||||
|
|
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" name="version" class="layui-input" th:value="${record.getVersion()}" id="version" readonly/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">物料类型:</label> |
||||
|
|
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" name="typeName" class="layui-input" id="typeName" readonly th:value="${record.getTypeName()}" |
||||
|
lay-verify="required"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">计量单位:</label> |
||||
|
|
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" name="oldUnit" class="layui-input" id="unit" readonly th:value="${record.getOldUnit()}" |
||||
|
lay-verify="required"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">拆单单位:</label> |
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" name="newUnit" class="layui-input" id="newUnit" th:value="${record.getNewUnit()}" |
||||
|
lay-verify="required"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<label class="layui-form-label">对应数目:</label> |
||||
|
|
||||
|
<div class="layui-input-block"> |
||||
|
<input type="text" name="quantity" class="layui-input" id="quantity" th:value="${record.getQuantity()}" |
||||
|
lay-verify="number"/> |
||||
|
</div> |
||||
|
</div> |
||||
|
|
||||
|
<div class="layui-form-item"> |
||||
|
<div class="layui-input-block"> |
||||
|
<button class="layui-btn" type="button" lay-submit lay-filter="formStep"> |
||||
|
 提交  |
||||
|
</button> |
||||
|
</div> |
||||
|
</div> |
||||
|
</form> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</div> |
||||
|
</fieldset> |
||||
|
</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 selectMaterialByName() { |
||||
|
} |
||||
|
|
||||
|
// 打开物料选择树 |
||||
|
function selectMaterial() { |
||||
|
} |
||||
|
|
||||
|
// 用于编码查询 |
||||
|
function selectCode(obj) { |
||||
|
} |
||||
|
|
||||
|
// 用于扫描条形码 |
||||
|
function scanBarCode(obj) { |
||||
|
} |
||||
|
|
||||
|
|
||||
|
// 用于扫码入库 |
||||
|
function scanCode(obj) { |
||||
|
} |
||||
|
|
||||
|
layui.use(['form', 'layer'], function () { |
||||
|
var $ = layui.jquery, |
||||
|
form = layui.form, |
||||
|
layer = layui.layer; |
||||
|
let id = $("#id").val(); |
||||
|
form.on('submit(formStep)', function (data) { |
||||
|
data = data.field; |
||||
|
data.state = 1; |
||||
|
$.ajax({ |
||||
|
url:"/split/split_edit", |
||||
|
data:JSON.stringify(data), |
||||
|
dataType:"json", |
||||
|
type:"post", |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success:function (res) { |
||||
|
layer.close(this.layerIndex); |
||||
|
if (data.status >= 300) { |
||||
|
layer.msg(data.statusInfo.detail,{ |
||||
|
icon:6, |
||||
|
time:1000 |
||||
|
},function () { |
||||
|
window.location="/split_edit?id="+id |
||||
|
});//失败的表情 |
||||
|
} else { |
||||
|
layer.msg("修改成功!", { |
||||
|
icon: 6,//成功的表情 |
||||
|
time: 1000 |
||||
|
}, //1秒关闭(如果不配置,默认是3秒) |
||||
|
function(){ |
||||
|
//do something |
||||
|
window.location="/split_edit?id="+id |
||||
|
}); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
}); |
||||
|
|
||||
|
// 通过名称查询物料 |
||||
|
selectMaterialByName = function (obj) { |
||||
|
let materialName = $("#mname"); |
||||
|
var data = materialName.val(); |
||||
|
var req = {}; |
||||
|
req.mname = data; |
||||
|
let materialId = $("#mid"); |
||||
|
let codeValue = $("#code"); |
||||
|
let version = $("#version"); |
||||
|
let typeName = $("#typeName"); |
||||
|
let unit = $("#unit"); |
||||
|
$.ajax({ |
||||
|
url: "/material/findMaterialByCondition", |
||||
|
type: "post", |
||||
|
dataType: 'json', |
||||
|
data: JSON.stringify(req), |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
if (d.count > 1) { |
||||
|
layer.msg("请点击右侧搜索确定物品"); |
||||
|
materialId.val(""); |
||||
|
codeValue.val(""); |
||||
|
version.val(""); |
||||
|
typeName.val(""); |
||||
|
unit.val(""); |
||||
|
return false; |
||||
|
} else if (d.count === 0) { |
||||
|
layer.msg("没有该物品,请确认输入是否正确"); |
||||
|
materialId.val(""); |
||||
|
codeValue.val(""); |
||||
|
materialName.val(""); |
||||
|
version.val(""); |
||||
|
typeName.val(""); |
||||
|
unit.val(""); |
||||
|
return false; |
||||
|
} else { |
||||
|
var material = d.data[0]; |
||||
|
materialName.val(material.mname); |
||||
|
materialId.val(material.mid); |
||||
|
codeValue.val(material.code); |
||||
|
version.val(material.version); |
||||
|
typeName.val(material.typeName); |
||||
|
unit.val(material.unit); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
// 打开物料选择树 |
||||
|
selectMaterial = function (obj) { |
||||
|
let mname = $("#mname").val(); |
||||
|
mname = mname.split(",")[0]; |
||||
|
layer.open({ |
||||
|
type: 2, |
||||
|
title: '弹窗内容', |
||||
|
skin: 'layui-layer-rim', |
||||
|
maxmin: true, |
||||
|
shadeClose: true, //点击遮罩关闭层 |
||||
|
area: ['70%', '70%'], |
||||
|
content: '/selectMaterial?mname=' + mname, |
||||
|
move: '.layui-layer-title', |
||||
|
fixed: false, |
||||
|
success: function (layero, index) { |
||||
|
let children = layero.children(); |
||||
|
let content = $(children[1]); |
||||
|
let iframeChildren = $(content.children()); |
||||
|
content.css('height', '100%'); |
||||
|
iframeChildren.css('height', '100%'); |
||||
|
}, |
||||
|
end: function () { |
||||
|
var mid = $("#mid").val(); |
||||
|
if (mid !== '') { |
||||
|
$.ajax({ |
||||
|
url: "/material/findMatrialById?mid=" + mid, |
||||
|
type: "get", |
||||
|
dataType: 'json', |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
var material = d.data.materialById; |
||||
|
var code = material.code; |
||||
|
if (code === undefined) { |
||||
|
code = ""; |
||||
|
} |
||||
|
$("#code").val(code); |
||||
|
$("#version").val(material.version); |
||||
|
$("#unit").val(material.unit); |
||||
|
$("#typeName").val(material.typeName); |
||||
|
var materialAndBarCodeList = material["materialAndBarCodeList"]; |
||||
|
if (materialAndBarCodeList.length > 0) { |
||||
|
// 如果有对应的条形码 |
||||
|
$("#barCode").remove(); |
||||
|
var barCodeSelect = ` |
||||
|
<select id="barCode" name= "barCode"></select>`; |
||||
|
$("#barCodeImg").before(barCodeSelect); |
||||
|
form.render(); |
||||
|
$.each(materialAndBarCodeList, function (index, item) { |
||||
|
$("#barCode").append(new Option(item.bmcode, item.id));//往下拉菜单里添加元素 |
||||
|
}); |
||||
|
form.render(); |
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
scanCodeInStorage = function (obj) { |
||||
|
var objIdNumber = obj.id.split("qrCodeImg")[1]; |
||||
|
parent.wx.scanQRCode({ |
||||
|
desc: 'scanQRCode desc', |
||||
|
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, |
||||
|
scanType: ["qrCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 |
||||
|
success: function (res) { |
||||
|
// 回调 |
||||
|
var result = res.resultStr;//当needResult为1时返回处理结果 |
||||
|
var req = {}; |
||||
|
req.qrCode = result; |
||||
|
$("#qrCode" + objIdNumber).val(result); |
||||
|
$.ajax({ |
||||
|
url: "/material/qywxApplicationInScanQrCode", |
||||
|
type: "post", |
||||
|
dataType: 'json', |
||||
|
data: JSON.stringify(req), |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
|
||||
|
} |
||||
|
|
||||
|
}) |
||||
|
} |
||||
|
}) |
||||
|
}; |
||||
|
|
||||
|
scanBarCode = function (obj) { |
||||
|
parent.wx.scanQRCode({ |
||||
|
desc: 'scanQRCode desc', |
||||
|
needResult: 1, // 默认为0,扫描结果由企业微信处理,1则直接返回扫描结果, |
||||
|
scanType: ["barCode"], // 可以指定扫二维码还是条形码(一维码),默认二者都有 |
||||
|
success: function (res) { |
||||
|
// 回调 |
||||
|
var result = res.resultStr;//当needResult为1时返回处理结果 |
||||
|
var req = {}; |
||||
|
req.qrCode = result; |
||||
|
$.ajax({ |
||||
|
url: "/material/qywxApplicationInScanBarCode", |
||||
|
type: "post", |
||||
|
dataType: 'json', |
||||
|
data: JSON.stringify(req), |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
|
||||
|
} |
||||
|
}) |
||||
|
|
||||
|
}, |
||||
|
error: function (res) { |
||||
|
if (res.errMsg.indexOf('function_not_exist') > 0) { |
||||
|
alert('版本过低请升级') |
||||
|
} |
||||
|
alert(res) |
||||
|
|
||||
|
} |
||||
|
}); |
||||
|
}; |
||||
|
|
||||
|
// 用于实现通过编码查询物料 |
||||
|
selectCode = function (obj) { |
||||
|
// 输入code |
||||
|
var code = obj.value; |
||||
|
var req = {}; |
||||
|
req.code = code; |
||||
|
req.type = "in"; |
||||
|
$.ajax({ |
||||
|
url: "/material/findMatrialByCode", |
||||
|
type: "get", |
||||
|
dataType: 'json', |
||||
|
data: req, |
||||
|
contentType: "application/json;charset=utf-8", |
||||
|
success: function (d) { |
||||
|
var d = d.data; |
||||
|
if (d == null) { |
||||
|
layer.msg("没有该编码,请确认是否输入正确"); |
||||
|
$("#mname").val(""); |
||||
|
$("#mid").val(""); |
||||
|
$("#code").val(""); |
||||
|
$("#barCode").val(""); |
||||
|
$("#version").val(""); |
||||
|
$("#unit").val(""); |
||||
|
$("#typeName").val(""); |
||||
|
form.render(); |
||||
|
|
||||
|
} else { |
||||
|
$("#mname").val(d.mname); |
||||
|
$("#mid").val( d.mid); |
||||
|
$("#version").val(d.version); |
||||
|
$("#unit").val(d.unit); |
||||
|
$("#typeName").val(d.typeName); |
||||
|
// 获取物料与条形码的对应关系 |
||||
|
var materialAndBarCodeList = d["materialAndBarCodeList"]; |
||||
|
if (materialAndBarCodeList.length > 0) { |
||||
|
// 如果有对应的条形码 |
||||
|
$("#barCode").remove(); |
||||
|
$(".layui-unselect").remove(); |
||||
|
var barCodeSelect = ` |
||||
|
<select id="barCode" name="barCode"> |
||||
|
</select>`; |
||||
|
$("#barCodeImg").before(barCodeSelect); |
||||
|
|
||||
|
form.render(); |
||||
|
$.each(materialAndBarCodeList, function (index, item) { |
||||
|
$("#barCode").append(new Option(item.bmcode, item.bmcode));//往下拉菜单里添加元素 |
||||
|
}); |
||||
|
form.render(); |
||||
|
} else { |
||||
|
$("#barCode").remove(); |
||||
|
$(".layui-unselect").remove(); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
}); |
||||
|
|
||||
|
}; |
||||
|
|
||||
|
}) |
||||
|
</script> |
||||
|
|
||||
|
</body> |
||||
|
</html> |
||||
Loading…
Reference in new issue