Commit 19f5c764 by zhanglt

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

parents 7d4714ab b14e8f23
......@@ -18,6 +18,7 @@
<%@ attribute name="validateMsg" type="java.lang.String" required="false" description="校验的未通过提示信息"%>
<%@ attribute name="disabled" type="java.lang.String" required="false" description="是否限制选择,如果限制,设置为disabled"%>
<%@ attribute name="callback" type="java.lang.String" required="false" description="选择回调"%>
<%@ attribute name="iframeUrl" type="java.lang.String" required="false" description="iframe框架url"%>
<input id="${id}Id" name="${name}" type="hidden" value="${value}"/>
<div class="input-group" style="width: 100%">
<input id="${id}Name" name="${labelName }" ${allowInput?'':'readonly="readonly"'} type="text" value="${labelValue}" data-msg-required="${dataMsgRequired}"
......@@ -68,9 +69,16 @@ $(document).ready(function(){
$("#${id}Id").val(ids.join(","));
$("#${id}Name").val(names.join(","));
if('${callback}' && window['${callback}']){
if('${callback}'){
if(window['${callback}']){
window['${callback}'](items);
}
<c:if test="${not empty iframeUrl}">
if(jp.getFrameWindow('${iframeUrl}')['${callback}']){
jp.getFrameWindow('${iframeUrl}')['${callback}'](items, '${id}'.match(/\d+/g)[0]);
}
</c:if>
}
top.layer.close(index);//关闭对话框。
},
......
<%@ tag language="java" pageEncoding="UTF-8"%>
<%@ include file="/webpage/include/taglib.jsp"%>
<%@ attribute name="id" type="java.lang.String" required="true" description="编号"%>
<%@ attribute name="name" type="java.lang.String" required="true" description="隐藏域名称(ID)"%>
<%@ attribute name="value" type="java.lang.String" required="false" description="隐藏域值(ID)"%>
<%@ attribute name="labelName" type="java.lang.String" required="fasle" description="输入框名称(Name)"%>
<%@ attribute name="labelValue" type="java.lang.String" required="false" description="输入框值(Name)"%>
<%@ attribute name="isMultiSelected" type="java.lang.Boolean" required="false" description="是否允许多选"%>
<%@ attribute name="cssClass" type="java.lang.String" required="false" description="css样式"%>
<%@ attribute name="cssStyle" type="java.lang.String" required="false" description="css样式"%>
<%@ attribute name="hideBtn" type="java.lang.Boolean" required="false" description="是否显示按钮"%>
<%@ attribute name="disabled" type="java.lang.String" required="false" description="是否限制选择,如果限制,设置为disabled"%>
<%@ attribute name="dataMsgRequired" type="java.lang.String" required="false" description=""%>
<%@ attribute name="callback" type="java.lang.String" required="false" description="回调"%>
<%@ attribute name="iframeUrl" type="java.lang.String" required="false" description="iframe窗口"%>
<input id="${id}Id" name="${name}" class="${cssClass} form-control" type="hidden" value="${value}"/>
<div class="input-group" style="width:100%">
<input id="${id}Name" name="${labelName}" ${allowInput?'':'readonly="readonly"'} type="text" value="${labelValue}" data-msg-required="${dataMsgRequired}"
class="${cssClass}" style="${cssStyle}"/>
<span class="input-group-btn">
<button type="button" id="${id}Button" class="btn <c:if test="${fn:contains(cssClass, 'input-sm')}"> btn-sm </c:if><c:if test="${fn:contains(cssClass, 'input-lg')}"> btn-lg </c:if> btn-primary ${disabled} ${hideBtn ? 'hide' : ''}"><i class="fa fa-search"></i>
</button>
<button type="button" id="${id}DelButton" class="close" data-dismiss="alert" style="position: absolute; top: 5px; right: 53px; z-index: 999; display: block;">×</button>
</span>
</div>
<label id="${id}Name-error" class="error" for="${id}Name" style="display:none"></label>
<script type="text/javascript">
$("#${id}Button, #${id}Name").click(function(){
// 是否限制选择,如果限制,设置为disabled
if ($("#${id}Button").hasClass("disabled")){
return true;
}
// 正常打开
jp.openShelvesSelectDialog(function(items){
if('${callback}'){
if(window['${callback}']){
window['${callback}'](items);
}
<c:if test="${not empty iframeUrl}">
var iframeWin = jp.getFrameWindow('${iframeUrl}');
if(iframeWin && iframeWin['${callback}']){
iframeWin['${callback}'](items, '${id}'.match(/\d+/g)[0]);
}
</c:if>
}
})
});
$("#${id}DelButton").click(function(){
// 是否限制选择,如果限制,设置为disabled
if ($("#${id}Button").hasClass("disabled")){
return true;
}
// 清除
$("#${id}Id").val("");
$("#${id}Name").val("");
$("#${id}Name").focus();
});
</script>
\ No newline at end of file
......@@ -711,7 +711,44 @@ function delRow(obj, prefix){
*/
getParent: function () {
return top.getActiveTab()[0].contentWindow;
},
getFrame: function (URL) {
// 查找所有iframe包括多层嵌套的iframe
var iframes = top.$("iframe");
var win = null
function getIframeWin(currentIframe){
var win = null;
if(currentIframe.attr("src").indexOf(URL) > -1){
// 获取当前iframe的window对象
win = currentIframe;
}else{
for(var i=0; i<currentIframe.contents().find("iframe").length; i++){
win = getIframeWin($(currentIframe.contents().find("iframe")[i]));
if(win){
break;
}
}
if(win){
return win;
}
}
return win;
}
for(var i=0; i<iframes.length; i++){
win = getIframeWin($(iframes[i]));
if(win){
break;
}
}
return win
},
getFrameWindow: function (URL) {
return this.getFrame(URL)[0].contentWindow
},
}
......
......@@ -92,20 +92,20 @@
}
},
{
field: 'ledgerInfo.amount',
title: '单价',
field: 'receiver.name',
title: '领用人',
formatter: function (value, row, index) {
return Mustache.render($("#ledgerInfoAmountTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""), {
return Mustache.render($("#receiverTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""), {
row: row,
idx: index
})
}
},
{
field: 'receiver.name',
title: '领用人',
field: 'remarks',
title: '备注',
formatter: function (value, row, index) {
return Mustache.render($("#receiverTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""), {
return Mustache.render($("#remarksTpl").html().replace(/(\/\/\<!\-\-)|(\/\/\-\->)/g, ""), {
row: row,
idx: index
})
......@@ -192,13 +192,13 @@
}, 0)
}
function onSelectType(nodes, rowIndex) {
function onSelectReceiver(nodes, rowIndex) {
if (Array.isArray(nodes) && nodes.length === 1) {
var node = nodes[0];
var obj = {
type: {
receiver: {
id: node.id,
name: node.text
name: node.name
}
};
updateRow(rowIndex, obj)
......@@ -342,7 +342,7 @@
</script>
<script id="receiverTpl" type="text/html">//<!--
<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>//-->
title="选择领用人" cssClass="form-control required" fieldLabels="领用人|手机|归属公司|归属部门" iframeUrl="/warehouse/materialrequisition/materialRequisition/form" validate="true" callback="onSelectReceiver" validateSelector="#officeId" validateMsg="请选择领用机构" fieldKeys="name|phone|company.name|office.name" searchLabels="领用人" searchKeys="name" ></sys:gridselect>//-->
</script>
<script id="remarksTpl" type="text/html">
<textarea id="storageInfoList{{idx}}_remarks" name="storageInfoList[{{idx}}].remarks" rows="2"
......
......@@ -300,10 +300,13 @@ $(document).ready(function() {
<table class="ani table">
<thead>
<tr>
<th>物资领用主表ID</th>
<th>物资台账明细ID</th>
<th>物资编码</th>
<th>物资名称</th>
<th>型号</th>
<th>类型</th>
<th>单价</th>
<th>领用人</th>
<th>备注信息</th>
<th>备注</th>
</tr>
</thead>
<tbody id="materialRequisitionChild-{{idx}}-1-List">
......@@ -315,10 +318,19 @@ $(document).ready(function() {
<script type="text/template" id="materialRequisitionChild1Tpl">//<!--
<tr>
<td>
{{row.materialRequisition.id}}
{{row.ledgerInfo.code}}
</td>
<td>
{{row.ledgerInfo.id}}
{{row.ledgerInfo.name}}
</td>
<td>
{{row.ledgerInfo.model}}
</td>
<td>
{{row.ledgerInfo.type.name}}
</td>
<td>
{{row.ledgerInfo.amount}}
</td>
<td>
{{row.receiver.name}}
......
......@@ -203,6 +203,20 @@
}
}
function onSelectShelves(nodes, rowIndex){
if(Array.isArray(nodes) && nodes.length === 1){
var node = nodes[0];
var obj = {
shelves: {
id: node.id,
name: node.name
},
warehouse: node.warehouse
};
updateRow(rowIndex, obj)
}
}
/**
* 获取所有明细数据
* @returns {*|jQuery}
......@@ -309,8 +323,8 @@
<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 id="shelvesTpl" type="text/html">//<!--
<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>//-->
<sys:shelvesselect id="storageInfoList{{idx}}_shelves" name="storageInfoList[{{idx}}].shelves.id" value="{{row.shelves.id}}" labelName="storageInfoList[{{idx}}].shelves.name" labelValue="{{row.shelves.name}}"
cssClass="form-control required" iframeUrl="/warehouse/storage/storage/form" callback="onSelectShelves"></sys:shelvesselect>//-->
</script>
<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>
......
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