Commit c377137b by zhanglt

Merge branch 'master' of http://gitlab.yqdchina.com/huyi/warehouse into zlt

parents 2c86de2d 4e1e4465
...@@ -5,6 +5,8 @@ package com.jeeplus.modules.warehouse.ledger.web; ...@@ -5,6 +5,8 @@ package com.jeeplus.modules.warehouse.ledger.web;
import java.io.UnsupportedEncodingException; import java.io.UnsupportedEncodingException;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -255,8 +257,7 @@ public class LedgerController extends BaseController { ...@@ -255,8 +257,7 @@ public class LedgerController extends BaseController {
*/ */
@ResponseBody @ResponseBody
@RequestMapping(value = "findByQrOrCode") @RequestMapping(value = "findByQrOrCode")
public AjaxJson findByQrOrCode(String qrId, String code) { public Map<String, Object>findByQrOrCode(String qrId, String code) {
AjaxJson j = new AjaxJson();
boolean b = false; boolean b = false;
if (StringUtils.isNotBlank(qrId)) { if (StringUtils.isNotBlank(qrId)) {
b = true; b = true;
...@@ -264,6 +265,8 @@ public class LedgerController extends BaseController { ...@@ -264,6 +265,8 @@ public class LedgerController extends BaseController {
if (StringUtils.isNotBlank(code)) { if (StringUtils.isNotBlank(code)) {
b = true; b = true;
} }
Map<String, Object> map = new HashMap<>();
List<LedgerInfo> ledgerInfoList = new ArrayList<>();
if (b) { if (b) {
LedgerInfo temLi = new LedgerInfo(); LedgerInfo temLi = new LedgerInfo();
QrCode qrCode = new QrCode(); QrCode qrCode = new QrCode();
...@@ -271,13 +274,10 @@ public class LedgerController extends BaseController { ...@@ -271,13 +274,10 @@ public class LedgerController extends BaseController {
temLi.setQr(qrCode); temLi.setQr(qrCode);
temLi.setCode(code); temLi.setCode(code);
LedgerInfo ledgerInfo = ledgerService.findByQrOrCode(temLi); LedgerInfo ledgerInfo = ledgerService.findByQrOrCode(temLi);
j.put("ledgerInfo", ledgerInfo); ledgerInfoList.add(ledgerInfo);
j.setSuccess(true); map.put("rows", ledgerInfoList);
j.setMsg("查询成功"); map.put("total", ledgerInfoList.size());
} else {
j.setSuccess(false);
j.setMsg("查询失败");
} }
return j; return map;
} }
} }
\ No newline at end of file
...@@ -13,6 +13,9 @@ ...@@ -13,6 +13,9 @@
<%@ attribute name="url" type="java.lang.String" required="true" description="数据地址"%> <%@ attribute name="url" type="java.lang.String" required="true" description="数据地址"%>
<%@ attribute name="cssClass" type="java.lang.String" required="false" description="css样式"%> <%@ attribute name="cssClass" type="java.lang.String" required="false" description="css样式"%>
<%@ attribute name="isMultiSelected" type="java.lang.Boolean" required="false" description="是否允许多选"%> <%@ attribute name="isMultiSelected" type="java.lang.Boolean" required="false" description="是否允许多选"%>
<%@ attribute name="validate" type="java.lang.Boolean" required="false" description="是否选择前校验"%>
<%@ attribute name="validateSelector" type="java.lang.String" required="false" description="校验的选择器"%>
<%@ attribute name="validateMsg" type="java.lang.String" required="false" description="校验的未通过提示信息"%>
<%@ attribute name="disabled" type="java.lang.String" required="false" description="是否限制选择,如果限制,设置为disabled"%> <%@ attribute name="disabled" type="java.lang.String" required="false" description="是否限制选择,如果限制,设置为disabled"%>
<%@ attribute name="callback" type="java.lang.String" required="false" description="选择回调"%> <%@ attribute name="callback" type="java.lang.String" required="false" description="选择回调"%>
<input id="${id}Id" name="${name}" type="hidden" value="${value}"/> <input id="${id}Id" name="${name}" type="hidden" value="${value}"/>
...@@ -33,7 +36,13 @@ $(document).ready(function(){ ...@@ -33,7 +36,13 @@ $(document).ready(function(){
if ($("#${id}Button").hasClass("disabled")){ if ($("#${id}Button").hasClass("disabled")){
return true; return true;
} }
if('${validate}' && '${validateSelector}'){
if(!$("${validateSelector}").val()){
jp.warning('${validateMsg}');
return;
}
}
top.layer.open({ top.layer.open({
type: 2, type: 2,
area: ['800px', '500px'], area: ['800px', '500px'],
......
...@@ -350,6 +350,29 @@ function delRow(obj, prefix){ ...@@ -350,6 +350,29 @@ function delRow(obj, prefix){
} }
}); });
}, },
openGridSelectDialog:function(params, yesFuc){
top.layer.open({
type: 2,
area: ['800px', '500px'],
title: params.title,
auto:true,
name:'friend',
content: ctx+"/tag/gridselect?url="+encodeURIComponent(params.url)+"&fieldLabels="+encodeURIComponent(params.fieldLabels)+"&fieldKeys="+encodeURIComponent(params.fieldKeys)+"&searchLabels="+encodeURIComponent(params.searchLabels)+"&searchKeys="+encodeURIComponent(params.searchKeys)+"&isMultiSelected="+params.isMultiSelect,
btn: ['确定', '关闭'],
yes: function(index, layero){
var iframeWin = layero.find('iframe')[0].contentWindow; //得到iframe页的窗口对象,执行iframe页的方法:iframeWin.method();
var items = iframeWin.getSelections();
if(items == ""){
jp.warning("必须选择一条数据!");
return;
}
yesFuc(items);
top.layer.close(index);//关闭对话框。
},
cancel: function(index){
}
});
},
dateFormat:function (timestamp, format) { dateFormat:function (timestamp, format) {
var _this = new Date(timestamp); var _this = new Date(timestamp);
var o = { var o = {
......
...@@ -232,5 +232,5 @@ ...@@ -232,5 +232,5 @@
</script> </script>
<script id="remarksTpl" type="text/html"> <script id="remarksTpl" type="text/html">
<textarea id="goodsInfoList{{idx}}_remarks" name="goodsInfoList[{{idx}}].remarks" rows="4" onchange="onInputChange('{{idx}}', this, 'remarks')" class="form-control ">{{row.remarks}}</textarea> <textarea id="goodsInfoList{{idx}}_remarks" name="goodsInfoList[{{idx}}].remarks" rows="2" onchange="onInputChange('{{idx}}', this, 'remarks')" class="form-control ">{{row.remarks}}</textarea>
</script> </script>
\ No newline at end of file
...@@ -9,184 +9,150 @@ ...@@ -9,184 +9,150 @@
<%@ include file="/webpage/include/taglib.jsp" %> <%@ include file="/webpage/include/taglib.jsp" %>
<table id="detail_table"></table> <table id="detail_table"></table>
<script> <script>
var selector = "#detail_table"; var selector = "#detail_table";
function initTable(){
var data = ${fns:toJson(ledger.ledgerInfoList)};
$(selector).bootstrapTable({
data: data,
columns:[
{
field: 'no',
title: '序号',
align: 'center',
width: 60,
formatter: function (value, row, index){
var tpl = $("#hideTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, "");
var html = Mustache.render(tpl, {
idx: index,
row: row
})
return html + '<span>'+(index+1)+'</span>' function initTable() {
} var data = [];
}, $(selector).bootstrapTable({
{ data: data,
field: 'name', columns: [
title: '名称', {
formatter: function (value,row,index){ field: 'no',
return Mustache.render($("#nameTpl").html(),{ title: '序号',
row: row, align: 'center',
idx: index width: 60,
}) formatter: function (value, row, index) {
} return '<span>' + (index + 1) + '</span>'
}, }
{ },
field: 'type.name', {
title: '类型', field: 'type.name',
formatter: function (value,row,index){ title: '类型',
return Mustache.render($("#typeTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""),{ align: 'center'
row: row, },
idx: index {
}) field: 'model',
} title: '型号',
}, align: 'center'
{ },
field: 'model', {
title: '型号', field: 'batchNum',
formatter: function (value,row,index){ title: '批次号',
return Mustache.render($("#modelTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""),{ align: 'center'
row: row, },
idx: index {
}) field: 'shelvesNames',
} title: '货架',
}, align: 'center'
{ },
field: 'batchNum', {
title: '批次号', field: 'warehouseNames',
formatter: function (value,row,index){ title: '仓库',
return Mustache.render($("#batchNumTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""),{ align: 'center'
row: row, },
idx: index {
}) title: '操作',
} align: 'center',
}, formatter: function (){
{ return '<a class="view-detail">查看明细</a>'
field: 'shelves.name', },
title: '货架', events: {
formatter: function (value,row,index){ 'click .view-detail': function (e,value,row){
return Mustache.render($("#shelvesTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""),{ layer.open({
row: row, title: '查看明细',
idx: index type: 1,
}) auto: true,
} area: ['800', '600'],
}, content: $("#detailTpl").html(),
{ success: function (){
field: 'code', $("#table").bootstrapTable({
title: '物资编码', method: 'get',
formatter: function (value,row,index){ url: '${ctx}/warehouse/ledger/ledger/infoDate?batchNum='+ row.batchNum+'&ledger.id=${ledger.id}',
return Mustache.render($("#codeTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""),{ page: true,
row: row, columns: [
idx: index {field: 'name', title: '物资名称'},
}) {field: 'type.name', title: '类型'},
} {field: 'model', title: '型号'},
}, {field: 'batchNum', title: '批次号'},
{ {field: 'shelves.name', title: '货架'},
field: '', {field: 'code', title: '物资编码'},
title: '操作', {field: 'amount', title: '单价'},
formatter: function (value,row,index){ ]
var text = row.delFlag == 1 ? '撤销删除' : '删除'; })
var result = ["<a href='javascript:void(0);' onclick=\"removeRow(" + index + ", '" + row.id + "', '" + row.delFlag + "')\">"+text+"</a>" ] },
return result.join(''); })
} }
} }
] }
}); ]
} });
function getSelections(){ jp.get("${ctx}/warehouse/ledger/ledger/countLedger?id=${ledger.id}", function (ledger) {
return $(selector).bootstrapTable('getSelections'); var data = ledger.countLedgerInfoList || [];
} $(selector).bootstrapTable('append', data);
})
}
function removeRow(index, rowId, rowDelFlag){ function getSelections() {
if(rowId){ return $(selector).bootstrapTable('getSelections');
var delFlag = rowDelFlag === 1 ? 0 : 1
updateRow(index, {
delFlag: delFlag
})
}else{
$(selector).bootstrapTable("remove", {
field: '$index',
values: [index]
})
} }
}
function updateRow(index, row){
$(selector).bootstrapTable('updateRow', {
index: index,
row: row
})
}
function onInputChange(rowIndex, elem , field){
var obj = {};
obj[field] = $(elem).val()
var timer = null;
clearTimeout(timer);
timer = setTimeout(function (){
updateRow(rowIndex, obj)
}, 0)
}
function onSelectType(nodes, rowIndex){ function removeRow(index, rowId, rowDelFlag) {
if(Array.isArray(nodes) && nodes.length === 1){ if (rowId) {
var node = nodes[0]; var delFlag = rowDelFlag === 1 ? 0 : 1
var obj = { updateRow(index, {
type: { delFlag: delFlag
id: node.id, })
name: node.text } else {
$(selector).bootstrapTable("remove", {
field: '$index',
values: [index]
})
} }
};
updateRow(rowIndex, obj)
} }
}
/**
* 获取所有明细数据
* @returns {*|jQuery}
*/
function getTableData(){
return $(selector).bootstrapTable('getData');
}
</script>
<script id="hideTpl" type="text/html"> function updateRow(index, row) {
<input id="ledgerInfoList{{idx}}_id" name="ledgerInfoList[{{idx}}].id" type="hidden" value="{{row.id}}"/> $(selector).bootstrapTable('updateRow', {
<input id="ledgerInfoList{{idx}}_delFlag" name="ledgerInfoList[{{idx}}].delFlag" type="hidden" value="{{row.delFlag}}"/> index: index,
<input id="ledgerInfoList{{idx}}_goodsInfoId" name="ledgerInfoList[{{idx}}].goodsInfo.id" type="hidden" value="{{row.goodsInfo.id}}"/> row: row
<input id="ledgerInfoList{{idx}}_shelvesId" name="ledgerInfoList[{{idx}}].shelves.id" type="hidden" value="{{row.shelves.id}}" readonly class="form-control" /> })
<input id="ledgerInfoList{{idx}}_qrCodeId" name="ledgerInfoList[{{idx}}].qr.id" type="hidden" value="{{row.qr.id}}" readonly class="form-control" /> }
</script>
<script id="nameTpl" type="text/html">
<input id="ledgerInfoList{{idx}}_name" name="ledgerInfoList[{{idx}}].name" type="text" readonly value="{{row.name}}" onchange="onInputChange('{{idx}}', this, 'name')" class="form-control "/>
</script>
<script id="typeTpl" type="text/html">//<!--
<sys:treeselect id="ledgerInfoList{{idx}}_type" name="ledgerInfoList[{{idx}}].type.id" value="{{row.type.id}}" labelName="storageInfoList{{idx}}.type.name" labelValue="{{row.type.name}}"
title="类型" url="/warehouse/materialtype/materialType/treeData" cssClass="form-control " disabled="disabled" allowClear="true" allowSearch="true" callback="onSelectType" />//-->
</script>
<script id="modelTpl" type="text/html"> function onInputChange(rowIndex, elem, field) {
<input id="ledgerInfoList{{idx}}_model" name="ledgerInfoList[{{idx}}].model" type="text" value="{{row.model}}" readonly onchange="onInputChange('{{idx}}', this, 'model')" class="form-control "/> var obj = {};
</script> obj[field] = $(elem).val()
var timer = null;
clearTimeout(timer);
timer = setTimeout(function () {
updateRow(rowIndex, obj)
}, 0)
}
<script id="batchNumTpl" type="text/html"> function onSelectType(nodes, rowIndex) {
<input id="ledgerInfoList{{idx}}_batchNum" name="ledgerInfoList[{{idx}}].batchNum" type="text" value="{{row.batchNum}}" readonly onchange="onInputChange('{{idx}}', this, 'model')" class="form-control "/> if (Array.isArray(nodes) && nodes.length === 1) {
</script> var node = nodes[0];
var obj = {
type: {
id: node.id,
name: node.text
}
};
updateRow(rowIndex, obj)
}
}
<script id="shelvesTpl" type="text/html"> /**
<input id="ledgerInfoList{{idx}}_shelvesName" name="ledgerInfoList[{{idx}}].shelves.name" type="text" value="{{row.shelves.name}}" readonly onchange="onInputChange('{{idx}}', this, 'model')" class="form-control "/> * 获取所有明细数据
* @returns {*|jQuery}
*/
function getTableData() {
return $(selector).bootstrapTable('getData');
}
</script> </script>
<script id="codeTpl" type="text/html"> <script id="detailTpl" type="text/html">
<input id="ledgerInfoList{{idx}}_code" name="ledgerInfoList[{{idx}}].code" type="text" value="{{row.code}}" readonly class="form-control" /> <br>
</script> <div class="container-fluid">
<table id="table"></table>
</div>
</script>
\ No newline at end of file
...@@ -32,26 +32,25 @@ ...@@ -32,26 +32,25 @@
title="类型" url="/warehouse/materialtype/materialType/treeData" title="类型" url="/warehouse/materialtype/materialType/treeData"
extId="${ledger.id}" cssClass="form-control " allowClear="true"/> extId="${ledger.id}" cssClass="form-control " allowClear="true"/>
</td> </td>
</tr>
<tr>
<td>型号</td> <td>型号</td>
<td> <td>
<form:input path="model" htmlEscape="false" class="form-control "/> <form:input path="model" htmlEscape="false" class="form-control "/>
</td> </td>
</tr>
<tr>
<td>数量</td> <td>数量</td>
<td> <td>
<form:input path="num" htmlEscape="false" class="form-control "/> <form:input path="num" htmlEscape="false" class="form-control "/>
</td> </td>
</tr>
<tr>
<td>总价</td> <td>总价</td>
<td> <td>
<form:input path="sum" htmlEscape="false" class="form-control "/> <form:input path="sum" htmlEscape="false" class="form-control "/>
</td> </td>
<td colspan="2"></td> <td colspan="2"></td>
</tr> </tr>
<tr> <tr>
<td colspan="4"> <td colspan="6">
<%@include file="ledgerDetail.jsp" %> <%@include file="ledgerDetail.jsp" %>
</td> </td>
</tr> </tr>
...@@ -66,26 +65,6 @@ ...@@ -66,26 +65,6 @@
$(document).ready(function () { $(document).ready(function () {
initTable(); initTable();
}); });
function save() {
var isValidate = jp.validateForm('#inputForm');//校验表单
if(!isValidate){
return false;
}else{
jp.loading();
jp.post($("#inputForm").attr('action'),$('#inputForm').serialize(),function(data){
if(data.success){
jp.getParent().refresh();
var dialogIndex = parent.layer.getFrameIndex(window.name); // 获取窗口索引
parent.layer.close(dialogIndex);
jp.success(data.msg)
}else{
jp.error(data.msg);
}
})
}
}
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -307,7 +307,6 @@ $(document).ready(function() { ...@@ -307,7 +307,6 @@ $(document).ready(function() {
<table class="ani table"> <table class="ani table">
<thead> <thead>
<tr> <tr>
<th>物资名称</th>
<th>类型</th> <th>类型</th>
<th>型号</th> <th>型号</th>
<th>批次号</th> <th>批次号</th>
...@@ -324,9 +323,6 @@ $(document).ready(function() { ...@@ -324,9 +323,6 @@ $(document).ready(function() {
<script type="text/template" id="ledgerChild1Tpl">//<!-- <script type="text/template" id="ledgerChild1Tpl">//<!--
<tr> <tr>
<td> <td>
{{row.name}}
</td>
<td>
{{row.type.name}} {{row.type.name}}
</td> </td>
<td> <td>
......
...@@ -8,275 +8,359 @@ ...@@ -8,275 +8,359 @@
<%@ page contentType="text/html;charset=UTF-8" language="java" %> <%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/webpage/include/taglib.jsp" %> <%@ include file="/webpage/include/taglib.jsp" %>
<div id="toolbar" class="text-left"> <div id="toolbar" class="text-left">
<c:if test="${mode == 'add' || mode == 'edit'}"> <c:if test="${mode == 'add' || mode == 'edit'}">
<a class="btn btn-primary btn-sm" onclick="addDetail('#detail_table')" title="新增"><i class="fa fa-plus"></i> 手动添加</a> <a class="btn btn-primary btn-sm" onclick="addDetail('#detail_table')" title="新增"><i class="fa fa-plus"></i>
<a class="btn btn-primary btn-sm" onclick="addScan('#detail_table')" title="新增"><i class="fa fa-plus"></i> 扫码添加</a> 手动添加</a>
<a id="editAll" class="btn btn-primary btn-sm" onclick="addShelve('#detail_table')" title="新增"><i class="fa fa-plus"></i> 批量编辑货架</a> <a class="btn btn-primary btn-sm" onclick="addScan('#detail_table')" title="新增"><i class="fa fa-plus"></i>
</c:if> 扫码添加</a>
<a id="editAll" class="btn btn-primary btn-sm" onclick="addReceiver('#detail_table')" title="新增"><i
class="fa fa-plus"></i> 批量编辑领用人</a>
</c:if>
</div> </div>
<table id="detail_table" data-toolbar="#toolbar"></table> <table id="detail_table" data-toolbar="#toolbar"></table>
<script> <script>
var selector = "#detail_table"; var selector = "#detail_table";
function initTable(){
var data = ${fns:toJson(materialRequisition.materialRequisitionInfoList)};
$(selector).bootstrapTable({
data: data,
columns:[{checkbox: true},
{
field: 'no',
title: '序号',
align: 'center',
width: 60,
formatter: function (value, row, index){
var tpl = $("#hideTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, "");
var html = Mustache.render(tpl, {
idx: index,
row: row
})
return html + '<span>'+(index+1)+'</span>' function initTable() {
} var data = ${fns:toJson(materialRequisition.materialRequisitionInfoList)};
}, $(selector).bootstrapTable({
{ data: data,
field: 'name', columns: [{checkbox: true},
title: '名称', {
formatter: function (value,row,index){ field: 'no',
return Mustache.render($("#nameTpl").html(),{ title: '序号',
row: row, align: 'center',
idx: index width: 60,
}) formatter: function (value, row, index) {
} var tpl = $("#hideTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, "");
}, var html = Mustache.render(tpl, {
{ idx: index,
field: 'type.name', row: row
title: '类型', })
formatter: function (value,row,index){
return Mustache.render($("#typeTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""),{
row: row,
idx: index
})
}
},
{
field: 'remarks',
title: '备注',
formatter: function (value,row,index){
return Mustache.render($("#remarksTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""),{
row: row,
idx: index
})
}
},
{
field: '',
title: '操作',
formatter: function (value,row,index){
var text = row.delFlag == 1 ? '撤销删除' : '删除';
var result = ["<a href='javascript:void(0);' onclick=\"removeRow(" + index + ", '" + row.id + "', '" + row.delFlag + "')\">"+text+"</a>" ]
return result.join('');
}
}
]
});
$(selector).on('check.bs.table uncheck.bs.table load-success.bs.table ' +
'check-all.bs.table uncheck-all.bs.table', function () {
$('#editAll').prop('disabled', !getSelections().length);
});
}
function getSelections(){ return html + '<span>' + (index + 1) + '</span>'
return $(selector).bootstrapTable('getSelections'); }
} },
{
field: 'ledgerInfo.name',
title: '物资名称',
formatter: function (value, row, index) {
return Mustache.render($("#ledgerInfoNameTpl").html(), {
row: row,
idx: index
})
}
},
{
field: 'ledgerInfo.code',
title: '物资编码',
formatter: function (value, row, index) {
return Mustache.render($("#ledgerInfoCodeTpl").html(), {
row: row,
idx: index
})
}
},
{
field: 'ledgerInfo.type.name',
title: '类型',
formatter: function (value, row, index) {
return Mustache.render($("#ledgerInfoTypeTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""), {
row: row,
idx: index
})
}
},
{
field: 'ledgerInfo.model',
title: '型号',
formatter: function (value, row, index) {
return Mustache.render($("#ledgerInfoModelTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""), {
row: row,
idx: index
})
}
},
{
field: 'ledgerInfo.amount',
title: '单价',
formatter: function (value, row, index) {
return Mustache.render($("#ledgerInfoAmountTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""), {
row: row,
idx: index
})
}
},
{
field: 'ledgerInfo.amount',
title: '单价',
formatter: function (value, row, index) {
return Mustache.render($("#ledgerInfoAmountTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""), {
row: row,
idx: index
})
}
},
{
field: 'receiver.name',
title: '领用人',
formatter: function (value, row, index) {
return Mustache.render($("#receiverTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""), {
row: row,
idx: index
})
}
},
{
field: '',
title: '操作',
formatter: function (value, row, index) {
var text = row.delFlag == 1 ? '撤销删除' : '删除';
var result = ["<a href='javascript:void(0);' onclick=\"removeRow(" + index + ", '" + row.id + "', '" + row.delFlag + "')\">" + text + "</a>"]
return result.join('');
}
}
]
});
$(selector).on('check.bs.table uncheck.bs.table load-success.bs.table ' +
'check-all.bs.table uncheck-all.bs.table', function () {
$('#editAll').prop('disabled', !getSelections().length);
});
}
/** function getSelections() {
* 手动添加明细 return $(selector).bootstrapTable('getSelections');
* @param selector
*/
function addDetail(selector){
// 选择该批次号下的货品明细
if(!$("#batchNum").val()){
jp.warning('请选择批次号!');
return;
} }
jp.openStorageSelectDialog({batchNum:$("#batchNum").val(),state: 0, isMultiSelect: true },function (items){ /**
if(Array.isArray(items)){ * 手动添加明细
var data = items.map(function (item){ * @param selector
if(item.goodsInfo && !item.goodsInfo.amount){ */
item.goodsInfo.amount = 0; function addDetail(selector) {
} jp.openGridSelectDialog({
return { title: '选择物资台账明细',
id: '', isMultiSelect: true,
delFlag: 0, url: "${ctx}/warehouse/ledger/ledger/findByQrOrCode",
remarks: '', fieldLabels: "物资编码|物资名称|类型|型号|批次号|单价",
...item fieldKeys: "code|name|type.name|model|batchNum|amount",
} searchLabels: "物资编码",
searchKeys: "code",
}, function (items) {
if (Array.isArray(items)) {
var data = items.map(function (item) {
item[0] = false;
return {
id: '',
delFlag: 0,
remarks: '',
ledgerInfo: item
}
})
$(selector).bootstrapTable('append', data)
}
}) })
$(selector).bootstrapTable('append', data) }
}
})
function removeRow(index, rowId, rowDelFlag) {
if (rowId) {
var delFlag = rowDelFlag === 1 ? 0 : 1
updateRow(index, {
delFlag: delFlag
})
} else {
$(selector).bootstrapTable("remove", {
field: '$index',
values: [index]
})
}
}
} function updateRow(index, row) {
function removeRow(index, rowId, rowDelFlag){ $(selector).bootstrapTable('updateRow', {
if(rowId){ index: index,
var delFlag = rowDelFlag === 1 ? 0 : 1 row: row
updateRow(index, { })
delFlag: delFlag
})
}else{
$(selector).bootstrapTable("remove", {
field: '$index',
values: [index]
})
} }
}
function updateRow(index, row){
$(selector).bootstrapTable('updateRow', {
index: index,
row: row
})
}
function onInputChange(rowIndex, elem , field){
var obj = {};
obj[field] = $(elem).val()
var timer = null;
clearTimeout(timer);
timer = setTimeout(function (){
updateRow(rowIndex, obj)
}, 0)
}
function onSelectType(nodes, rowIndex){ function onInputChange(rowIndex, elem, field) {
if(Array.isArray(nodes) && nodes.length === 1){ var obj = {};
var node = nodes[0]; obj[field] = $(elem).val()
var obj = { var timer = null;
type: { clearTimeout(timer);
id: node.id, timer = setTimeout(function () {
name: node.text updateRow(rowIndex, obj)
}, 0)
}
function onSelectType(nodes, rowIndex) {
if (Array.isArray(nodes) && nodes.length === 1) {
var node = nodes[0];
var obj = {
type: {
id: node.id,
name: node.text
}
};
updateRow(rowIndex, obj)
} }
};
updateRow(rowIndex, obj)
} }
}
/** /**
* 获取所有明细数据 * 获取所有明细数据
* @returns {*|jQuery} * @returns {*|jQuery}
*/ */
function getTableData(){ function getTableData() {
return $(selector).bootstrapTable('getData'); return $(selector).bootstrapTable('getData');
} }
function addShelve(){ function addReceiver() {
jp.openShelvesSelectDialog(function (items){
var Shelve = items[0];
// TODO: 获取选中的明细下标
getSelections().forEach(function (item){
var index = getTableData().findIndex(function (current){
return current.qrCode.id === item.qrCode.id;
})
updateRow(index,{
shelves: {
id: Shelve.id,
name: Shelve.name
},
warehouse: Shelve.warehouse
})
})
}) if (!$("#officeId").val()) {
} jp.warning('请选择领用机构!');
return;
}
/** if(!getSelections().length){
* 点击扫码显示扫码窗口 jp.warning('请添加并勾选明细!');
*/ return;
function addScan(){ }
layer.open({
type: 1,
title: '扫码',
auto: true,
area: ['500','300'],
content: $("#scanResultTpl").html(),
success: function (){
$("#scanResult").focus();
},
btn:['关闭']
})
}
/** jp.openGridSelectDialog({
* 扫码 title: '选择领用人',
* 一、获取扫码结果 isMultiSelect: false,
* 二、请求后台接口获取结果 url: "${ctx}/sys/user/list?office.id=" + $("#officeId").val(),
* 三、增一条明细数据 fieldLabels: "领用人|手机|归属公司|归属部门",
* 四、清空扫码结果 fieldKeys: "name|phone|company.name|office.name",
* @param elem searchLabels: "领用人",
*/ searchKeys: "name",
function onScanChange(elem){
try{ }, function (items) {
var json = JSON.parse($(elem).val()); var receiver = items[0];
var qrCodeId = json.code; // TODO: 获取选中的明细下标
var goodsInfoId = json.infoId; getSelections().forEach(function (item) {
jp.get('${ctx}/warehouse/goods/goods/getGIAndQCByTwoId?goodsInfoId='+goodsInfoId+"&qrCodeId="+qrCodeId, function (res){ var index = getTableData().findIndex(function (current) {
var qrCode = res.body.qrCode; return current.ledgerInfo.id === item.ledgerInfo.id;
$(selector).bootstrapTable('append',[ })
{ updateRow(index, {
qrCode: qrCode, receiver: receiver
goodsInfo: qrCode.goodsInfo, })
...qrCode.goodsInfo, })
id: '',
delFlag: 0,
remarks: ''
}
]);
$(elem).val('').focus();
})
}catch (e){ })
console.log(e); }
/**
* 点击扫码显示扫码窗口
*/
function addScan() {
layer.open({
type: 1,
title: '扫码',
auto: true,
area: ['500', '300'],
content: $("#scanResultTpl").html(),
success: function () {
$("#scanResult").focus();
},
btn: ['关闭']
})
}
/**
* 扫码
* 一、获取扫码结果
* 二、请求后台接口获取结果
* 三、增一条明细数据
* 四、清空扫码结果
* @param elem
*/
function onScanChange(elem) {
try {
var json = JSON.parse($(elem).val());
var qrCodeId = json.code;
jp.get('${ctx}/warehouse/ledger/ledger/findByQrOrCode?qrCodeId=' + qrCodeId, function (res) {
var data = res.rows || [];
if (data.length) {
var item = data[0];
$(selector).bootstrapTable('append', [
{
id: '',
delFlag: 0,
remarks: '',
ledgerInfo: item
}
]);
$(elem).val('').focus();
}else{
jp.warning('未找到任何数据!');
$(elem).val('').focus();
}
})
} catch (e) {
console.log(e);
}
} }
}
</script> </script>
<script id="hideTpl" type="text/html"> <script id="hideTpl" type="text/html">
<input id="materialRequisitionInfoList{{idx}}_id" name="materialRequisitionInfoList[{{idx}}].id" type="hidden" value="{{row.id}}"/> <input id="materialRequisitionInfoList{{idx}}_id" name="materialRequisitionInfoList[{{idx}}].id" type="hidden"
<input id="materialRequisitionInfoList{{idx}}_delFlag" name="materialRequisitionInfoList[{{idx}}].delFlag" type="hidden" value="{{row.delFlag}}"/> value="{{row.id}}"/>
<input id="materialRequisitionInfoList{{idx}}_materialRequisition" name="materialRequisitionInfoList[{{idx}}].materialRequisition.id" type="hidden" value="{{row.materialRequisition.id}}"/> <input id="materialRequisitionInfoList{{idx}}_delFlag" name="materialRequisitionInfoList[{{idx}}].delFlag"
type="hidden" value="{{row.delFlag}}"/>
<input id="materialRequisitionInfoList{{idx}}_materialRequisition"
name="materialRequisitionInfoList[{{idx}}].materialRequisition.id" type="hidden"
value="{{row.materialRequisition.id}}"/>
<input id="materialRequisitionInfoList{{idx}}_ledgerInfoId"
name="materialRequisitionInfoList[{{idx}}].ledgerInfo.id" type="hidden" value="{{row.ledgerInfo.id}}"/>
</script> </script>
<script id="ledgerInfoTpl" type="text/html">//<!-- <script id="ledgerInfoNameTpl" type="text/html">
<sys:gridselect url="${ctx}/warehouse/ledger/ledger/data" id="materialRequisitionInfoList{{idx}}_ledgerInfo" name="materialRequisitionInfoList[{{idx}}].ledgerInfo.id" value="{{row.ledgerInfo.id}}" labelName="materialRequisitionInfoList[{{idx}}].ledgerInfo.name" labelValue="{{row.ledgerInfo.name}}" <input id="materialRequisitionInfoList{{idx}}_ledgerInfoName" readonly
title="选择物资" cssClass="form-control required" fieldLabels="物资名称|物资编号" fieldKeys="name|code" searchLabels="仓库名称|仓库编号" searchKeys="name|code" ></sys:gridselect>//--> name="materialRequisitionInfoList[{{idx}}].ledgerInfo.name" type="text" class="form-control"
value="{{row.ledgerInfo.name}}"/>
</script> </script>
<script id="ledgerInfoCodeTpl" type="text/html">
<script id="typeTpl" type="text/html">//<!-- <input id="materialRequisitionInfoList{{idx}}_ledgerInfoCode" readonly
<sys:treeselect id="storageInfoList{{idx}}_type" name="storageInfoList[{{idx}}].type.id" value="{{row.type.id}}" labelName="storageInfoList{{idx}}.type.name" labelValue="{{row.type.name}}" name="materialRequisitionInfoList[{{idx}}].ledgerInfo.code" type="text" class="form-control"
title="类型" url="/warehouse/materialtype/materialType/treeData" cssClass="form-control " disabled="disabled" allowClear="true" allowSearch="true" callback="onSelectType" />//--> value="{{row.ledgerInfo.code}}"/>
</script> </script>
<script id="modelTpl" type="text/html"> <script id="ledgerInfoTypeTpl" type="text/html">//<!--
<input id="storageInfoList{{idx}}_model" name="storageInfoList[{{idx}}].model" type="text" value="{{row.model}}" readonly onchange="onInputChange('{{idx}}', this, 'model')" class="form-control "/> <sys:treeselect id="materialRequisitionInfoList{{idx}}_ledgerInfoType" name="materialRequisitionInfoList[{{idx}}].ledgerInfo.type.id" value="{{row.ledgerInfo.type.id}}" labelName="materialRequisitionInfoList{{idx}}.ledgerInfo.type.name" labelValue="{{row.ledgerInfo.type.name}}"
title="类型" url="/warehouse/materialtype/materialType/treeData" cssClass="form-control " disabled="disabled" allowClear="true"/>//-->
</script>
<script id="ledgerInfoModelTpl" type="text/html">
<input id="materialRequisitionInfoList{{idx}}_ledgerInfoModel"
name="materialRequisitionInfoList[{{idx}}].ledgerInfo.model" type="text" class="form-control" readonly
value="{{row.ledgerInfo.model}}"/>
</script>
<script id="ledgerInfoAmountTpl" type="text/html">
<input id="materialRequisitionInfoList{{idx}}_ledgerInfoAmount"
name="materialRequisitionInfoList[{{idx}}].ledgerInfo.amount" type="text" readonly class="form-control"
value="{{row.ledgerInfo.amount}}"/>
</script> </script>
<script id="shelvesTpl" type="text/html"> <script id="receiverTpl" type="text/html">//<!--
<input id="storageInfoList{{idx}}_shelvesName" name="storageInfoList[{{idx}}].shelves.name" type="text" value="{{row.shelves.name}}" readonly class="form-control" /> <sys:gridselect url="${ctx}/sys/user/list" id="materialRequisitionInfoList{{idx}}_receiver" name="materialRequisitionInfoList[{{idx}}].receiver.id" value="{{row.receiver.id}}" labelName="materialRequisitionInfoList[{{idx}}].receiver.name" labelValue="{{row.receiver.name}}"
title="选择领用人" cssClass="form-control required" fieldLabels="领用人|手机|归属公司|归属部门" validate="true" validateSelector="#officeId" validateMsg="请选择领用机构" fieldKeys="name|phone|company.name|office.name" searchLabels="领用人" searchKeys="name" ></sys:gridselect>//-->
</script> </script>
<script id="remarksTpl" type="text/html"> <script id="remarksTpl" type="text/html">
<textarea id="storageInfoList{{idx}}_remarks" name="storageInfoList[{{idx}}].remarks" rows="2" onchange="onInputChange('{{idx}}', this, 'remarks')" class="form-control ">{{row.remarks}}</textarea> <textarea id="storageInfoList{{idx}}_remarks" name="storageInfoList[{{idx}}].remarks" rows="2"
onchange="onInputChange('{{idx}}', this, 'remarks')" class="form-control ">{{row.remarks}}</textarea>
</script> </script>
<script id="scanResultTpl" type="text/html"> <script id="scanResultTpl" type="text/html">
<br> <br>
<div class="container-fluid"> <div class="container-fluid">
<div class="row"> <div class="row">
<div class="col-xs-2 text-right"> <div class="col-xs-2 text-right">
<label>扫码结果:</label> <label>扫码结果:</label>
</div> </div>
<div class="col-xs-10"> <div class="col-xs-10">
<input type="text" id="scanResult" class="form-control" onchange="onScanChange(this)"> <input type="text" id="scanResult" class="form-control" onchange="onScanChange(this)">
<span class="text-danger">请切换英文输入法</span> <span class="text-danger">请切换英文输入法</span>
</div> </div>
</div>
</div> </div>
</div> <br>
<br>
</script> </script>
\ No newline at end of file
...@@ -55,91 +55,16 @@ ...@@ -55,91 +55,16 @@
</tr> </tr>
<tr> <tr>
<td>备注</td> <td>备注</td>
<td> <td colspan="3">
<form:textarea path="remarks" htmlEscape="false" rows="4" class="form-control "/> <form:textarea path="remarks" htmlEscape="false" rows="4" class="form-control "/>
</td> </td>
</tr> </tr>
<tr>
<td colspan="4">
<%@include file="materialRequisitionDetail.jsp" %>
</td>
</tr>
</table> </table>
<div class="tabs-container">
<ul class="nav nav-tabs">
<li class="active"><a data-toggle="tab" href="#tab-1"
aria-expanded="true">领用明细表:</a>
</li>
</ul>
<div class="tab-content">
<div id="tab-1" class="tab-pane fade in active">
<a class="btn btn-white btn-sm"
onclick="addRow('#materialRequisitionInfoList', materialRequisitionInfoRowIdx, materialRequisitionInfoTpl);materialRequisitionInfoRowIdx = materialRequisitionInfoRowIdx + 1;"
title="新增"><i class="fa fa-plus"></i> 新增</a>
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th class="hide"></th>
<th>物资领用主表ID</th>
<th>物资台账明细ID</th>
<th>领用人</th>
<th>备注信息</th>
<th width="10">&nbsp;</th>
</tr>
</thead>
<tbody id="materialRequisitionInfoList">
</tbody>
</table>
<script type="text/template" id="materialRequisitionInfoTpl">//<!--
<tr id="materialRequisitionInfoList{{idx}}">
<td class="hide">
<input id="materialRequisitionInfoList{{idx}}_id" name="materialRequisitionInfoList[{{idx}}].id" type="hidden" value="{{row.id}}"/>
<input id="materialRequisitionInfoList{{idx}}_delFlag" name="materialRequisitionInfoList[{{idx}}].delFlag" type="hidden" value="0"/>
</td>
<td>
<input id="materialRequisitionInfoList{{idx}}_materialRequisition" name="materialRequisitionInfoList[{{idx}}].materialRequisition.id" type="text" value="{{row.materialRequisition.id}}" class="form-control "/>
</td>
<td>
<input id="materialRequisitionInfoList{{idx}}_ledgerInfo" name="materialRequisitionInfoList[{{idx}}].ledgerInfo.id" type="text" value="{{row.ledgerInfo.id}}" class="form-control "/>
</td>
<td>
<input id="materialRequisitionInfoList{{idx}}_receiver" name="materialRequisitionInfoList[{{idx}}].receiver" type="text" value="{{row.receiver.id}}" class="form-control "/>
</td>
<td>
<textarea id="materialRequisitionInfoList{{idx}}_remarks" name="materialRequisitionInfoList[{{idx}}].remarks" rows="4" class="form-control ">{{row.remarks}}</textarea>
</td>
<td class="text-center" width="10">
{{#delBtn}}<span class="close" onclick="delRow(this, '#materialRequisitionInfoList{{idx}}')" title="删除">&times;</span>{{/delBtn}}
</td>
</tr>//-->
</script>
<script type="text/javascript">
var materialRequisitionInfoRowIdx = 0,
materialRequisitionInfoTpl = $("#materialRequisitionInfoTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, "");
$(document).ready(function () {
var data = ${fns:toJson(materialRequisition.materialRequisitionInfoList)};
for (var i = 0; i < data.length; i++) {
addRow('#materialRequisitionInfoList', materialRequisitionInfoRowIdx, materialRequisitionInfoTpl, data[i]);
materialRequisitionInfoRowIdx = materialRequisitionInfoRowIdx + 1;
}
});
</script>
</div>
</div>
</div>
<c:if test="${mode == 'add' || mode=='edit'}">
<div class="col-lg-3"></div>
<div class="col-lg-6">
<div class="form-group text-center">
<div>
<button class="btn btn-primary btn-block btn-lg btn-parsley"
data-loading-text="正在提交...">提 交
</button>
</div>
</div>
</div>
</c:if>
</form:form> </form:form>
</div> </div>
</div> </div>
...@@ -149,6 +74,7 @@ ...@@ -149,6 +74,7 @@
<script type="text/javascript"> <script type="text/javascript">
$(document).ready(function() { $(document).ready(function() {
initTable();
jp.ajaxForm("#inputForm",function(data){ jp.ajaxForm("#inputForm",function(data){
if(data.success){ if(data.success){
jp.success(data.msg); jp.success(data.msg);
...@@ -163,6 +89,27 @@ ...@@ -163,6 +89,27 @@
format: "YYYY-MM-DD HH:mm:ss" format: "YYYY-MM-DD HH:mm:ss"
}); });
}); });
function save() {
var isValidate = jp.validateForm('#inputForm');//校验表单
if(!isValidate){
return false;
}else{
jp.loading();
jp.post($("#inputForm").attr('action'),$('#inputForm').serialize(),function(data){
if(data.success){
jp.getParent().refresh();
var dialogIndex = parent.layer.getFrameIndex(window.name); // 获取窗口索引
parent.layer.close(dialogIndex);
jp.success(data.msg)
}else{
jp.error(data.msg);
}
})
}
}
</script> </script>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -114,7 +114,7 @@ $(document).ready(function() { ...@@ -114,7 +114,7 @@ $(document).ready(function() {
} }
,{ ,{
field: 'warehouse.name', field: 'warehouse.name',
title: '仓库id', title: '仓库',
sortable: true, sortable: true,
sortName: 'warehouse.name' sortName: 'warehouse.name'
} }
......
...@@ -118,10 +118,10 @@ ...@@ -118,10 +118,10 @@
jp.warning('请选择批次号!'); jp.warning('请选择批次号!');
return; return;
} }
jp.openStorageSelectDialog({batchNum:$("#batchNum").val(),state: 0, isMultiSelect: true },function (items){ jp.openStorageSelectDialog({batchNum:$("#batchNum").val(),state: 0, isMultiSelect: true },function (items){
if(Array.isArray(items)){ if(Array.isArray(items)){
var data = items.map(function (item){ var data = items.map(function (item){
item[0] = false;
if(item.goodsInfo && !item.goodsInfo.amount){ if(item.goodsInfo && !item.goodsInfo.amount){
item.goodsInfo.amount = 0; item.goodsInfo.amount = 0;
} }
...@@ -135,9 +135,14 @@ ...@@ -135,9 +135,14 @@
$(selector).bootstrapTable('append', data) $(selector).bootstrapTable('append', data)
} }
}) })
} }
/**
* 删除明细
* @param index
* @param rowId
* @param rowDelFlag
*/
function removeRow(index, rowId, rowDelFlag){ function removeRow(index, rowId, rowDelFlag){
if(rowId){ if(rowId){
var delFlag = rowDelFlag === 1 ? 0 : 1 var delFlag = rowDelFlag === 1 ? 0 : 1
...@@ -151,12 +156,25 @@ ...@@ -151,12 +156,25 @@
}) })
} }
} }
/**
* 更新行
* @param index 下标
* @param row 更新对象
*/
function updateRow(index, row){ function updateRow(index, row){
$(selector).bootstrapTable('updateRow', { $(selector).bootstrapTable('updateRow', {
index: index, index: index,
row: row row: row
}) })
} }
/**
* 监听input值,并更新行
* @param rowIndex 更新行的下标
* @param elem 元素
* @param field 属性
*/
function onInputChange(rowIndex, elem , field){ function onInputChange(rowIndex, elem , field){
var obj = {}; var obj = {};
obj[field] = $(elem).val() obj[field] = $(elem).val()
...@@ -167,6 +185,11 @@ ...@@ -167,6 +185,11 @@
}, 0) }, 0)
} }
/**
* 监听类型选择回调并更新行
* @param nodes 选中数据
* @param rowIndex 行下标
*/
function onSelectType(nodes, rowIndex){ function onSelectType(nodes, rowIndex){
if(Array.isArray(nodes) && nodes.length === 1){ if(Array.isArray(nodes) && nodes.length === 1){
var node = nodes[0]; var node = nodes[0];
...@@ -188,14 +211,16 @@ ...@@ -188,14 +211,16 @@
return $(selector).bootstrapTable('getData'); return $(selector).bootstrapTable('getData');
} }
/**
* 批量添加货架
*/
function addShelve(){ function addShelve(){
jp.openShelvesSelectDialog(function (items){ jp.openShelvesSelectDialog(function (items){
var Shelve = items[0]; var Shelve = items[0]; // 货架对象
// TODO: 获取选中的明细下标
getSelections().forEach(function (item){ getSelections().forEach(function (item){
var index = getTableData().findIndex(function (current){ var index = getTableData().findIndex(function (current){
return current.qrCode.id === item.qrCode.id; return current.qrCode.id === item.qrCode.id;
}) }); // 需更新的行的下标
updateRow(index,{ updateRow(index,{
shelves: { shelves: {
id: Shelve.id, id: Shelve.id,
...@@ -265,7 +290,6 @@ ...@@ -265,7 +290,6 @@
<input id="storageInfoList{{idx}}_goodsInfoId" name="storageInfoList[{{idx}}].goodsInfo.id" type="hidden" value="{{row.goodsInfo.id}}"/> <input id="storageInfoList{{idx}}_goodsInfoId" name="storageInfoList[{{idx}}].goodsInfo.id" type="hidden" value="{{row.goodsInfo.id}}"/>
<input id="storageInfoList{{idx}}_goodsInfoName" name="storageInfoList[{{idx}}].goodsInfo.name" type="hidden" value="{{row.goodsInfo.name}}"/> <input id="storageInfoList{{idx}}_goodsInfoName" name="storageInfoList[{{idx}}].goodsInfo.name" type="hidden" value="{{row.goodsInfo.name}}"/>
<input id="storageInfoList{{idx}}_goodsInfoAmount" name="storageInfoList[{{idx}}].goodsInfo.amount" type="hidden" value="{{row.goodsInfo.amount}}"/> <input id="storageInfoList{{idx}}_goodsInfoAmount" name="storageInfoList[{{idx}}].goodsInfo.amount" type="hidden" value="{{row.goodsInfo.amount}}"/>
<input id="storageInfoList{{idx}}_shelvesId" name="storageInfoList[{{idx}}].shelves.id" type="hidden" value="{{row.shelves.id}}" readonly class="form-control" />
<input id="storageInfoList{{idx}}_warehouseId" name="storageInfoList[{{idx}}].warehouse.id" type="hidden" value="{{row.warehouse.id}}" readonly class="form-control" /> <input id="storageInfoList{{idx}}_warehouseId" name="storageInfoList[{{idx}}].warehouse.id" type="hidden" value="{{row.warehouse.id}}" readonly class="form-control" />
<input id="storageInfoList{{idx}}_amount" name="storageInfoList[{{idx}}].amount" type="hidden" value="{{row.amount}}" readonly class="form-control" /> <input id="storageInfoList{{idx}}_amount" name="storageInfoList[{{idx}}].amount" type="hidden" value="{{row.amount}}" readonly class="form-control" />
<input id="storageInfoList{{idx}}_qrCodeId" name="storageInfoList[{{idx}}].qrCode.id" type="hidden" value="{{row.qrCode.id}}" readonly class="form-control" /> <input id="storageInfoList{{idx}}_qrCodeId" name="storageInfoList[{{idx}}].qrCode.id" type="hidden" value="{{row.qrCode.id}}" readonly class="form-control" />
...@@ -284,8 +308,9 @@ ...@@ -284,8 +308,9 @@
<script id="modelTpl" type="text/html"> <script id="modelTpl" type="text/html">
<input id="storageInfoList{{idx}}_model" name="storageInfoList[{{idx}}].model" type="text" value="{{row.model}}" readonly onchange="onInputChange('{{idx}}', this, 'model')" class="form-control "/> <input id="storageInfoList{{idx}}_model" name="storageInfoList[{{idx}}].model" type="text" value="{{row.model}}" readonly onchange="onInputChange('{{idx}}', this, 'model')" class="form-control "/>
</script> </script>
<script id="shelvesTpl" type="text/html"> <script id="shelvesTpl" type="text/html">//<!--
<input id="storageInfoList{{idx}}_shelvesName" name="storageInfoList[{{idx}}].shelves.name" type="text" value="{{row.shelves.name}}" readonly class="form-control" /> <sys:gridselect url="${ctx}/warehouse/shelves/shelves/data" id="storageInfoList{{idx}}_shelves" name="storageInfoList[{{idx}}].shelves.id" value="{{row.shelves.id}}" labelName="storageInfoList[{{idx}}].shelves.name" labelValue="{{row.shelves.name}}"
title="选择货架" cssClass="form-control required" fieldLabels="货架名称|货架编号" fieldKeys="name|code" searchLabels="仓库名称|仓库编号" searchKeys="name|code" ></sys:gridselect>//-->
</script> </script>
<script id="remarksTpl" type="text/html"> <script id="remarksTpl" type="text/html">
<textarea id="storageInfoList{{idx}}_remarks" name="storageInfoList[{{idx}}].remarks" rows="2" onchange="onInputChange('{{idx}}', this, 'remarks')" class="form-control ">{{row.remarks}}</textarea> <textarea id="storageInfoList{{idx}}_remarks" name="storageInfoList[{{idx}}].remarks" rows="2" onchange="onInputChange('{{idx}}', this, 'remarks')" class="form-control ">{{row.remarks}}</textarea>
......
...@@ -331,7 +331,8 @@ $(document).ready(function() { ...@@ -331,7 +331,8 @@ $(document).ready(function() {
var qrId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].qr.id' value='"+item.qrCode.id+"' />"); var qrId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].qr.id' value='"+item.qrCode.id+"' />");
var shelvesId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].shelves.id' value='"+item.shelves.id+"' />"); var shelvesId$ = $("<input type='hidden' name='ledgerInfoList["+index+"].shelves.id' value='"+item.shelves.id+"' />");
var code$ = $("<input type='hidden' name='ledgerInfoList["+index+"].code' value='"+item.qrCode.code+"' />"); var code$ = $("<input type='hidden' name='ledgerInfoList["+index+"].code' value='"+item.qrCode.code+"' />");
$("#ledgerForm").append(id$).append(delFlag$).append(name$).append(typeId$).append(batchNum$).append(model$).append(goodsInfoId$).append(qrId$).append(shelvesId$).append(code$); var amount$ = $("<input type='hidden' name='ledgerInfoList["+index+"].amount' value='"+item.amount+"' />");
$("#ledgerForm").append(id$).append(delFlag$).append(name$).append(typeId$).append(batchNum$).append(model$).append(goodsInfoId$).append(qrId$).append(shelvesId$).append(code$).append(amount$);
}) })
jp.loading('入库中...'); jp.loading('入库中...');
jp.post("${ctx}/warehouse/ledger/ledger/save", $("#ledgerForm").serialize(), function (res){ jp.post("${ctx}/warehouse/ledger/ledger/save", $("#ledgerForm").serialize(), function (res){
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment