Files
OMS/app/material/view/admin/barcode/add.html
2026-01-04 19:08:31 +08:00

98 lines
4.0 KiB
HTML

<!--
Copyright 2012-2026 ShopeX (https://www.shopex.cn)
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<div class="tableform">
<form action="" method="post" id="barcode_manage">
<div class="division">
<table width="100%" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td width="17%">关联基础物料:</td>
<td>
<{input type='material_object' object='basic_material@material' breakpoint='0' name='bm_id' textcol='material_name' value=$data.pgid callback='material_object_callback' replacehtml=$replacehtml emptytext='选取基础物料' style='float:left;width:200px;' filter='visibled=1' }>
</td>
</tr>
<tr>
<th width="80">条码:</th>
<td ><{input type="text&&required" name="barcode"}></td>
</tr>
</tbody>
</table>
</div>
<table width="100%" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td colspan="2" align="center">
<{button class="btn-primary" label="确定" type="button" id="msaveBtn"}>
<{button class="btn-primary" label="取消" type="button" id="mcancelBtn"}>
</td>
</tr>
</tbody>
</table>
</form>
</div>
<script>
(function() {
var form = $('barcode_manage');
//关闭按钮
$('mcancelBtn').addEvent('click', function(){
$('mcancelBtn').getParent('.dialog').retrieve('instance').close();
});
//保存按钮
$('msaveBtn').addEvent('click', function(){
new Request ({
url:'index.php?app=material&ctl=admin_barcode&act=toAdd',
method:'post',
data:form.toQueryString(),
onRequest: function () {
$('msaveBtn').set('disabled', 'true');
$('mcancelBtn').set('disabled', 'true');
},
onSuccess: function(result) {
if (result =='SUCC') {
finderGroup["<{$env.get.finder_id}>"].refresh.delay(400,finderGroup["<{$env.get.finder_id}>"]);
$('msaveBtn').getParent('.dialog').retrieve('instance').close();
} else {
$('msaveBtn').set('disabled', '');
$('mcancelBtn').set('disabled', '');
//提示信息
alert(result);
}
}
}).send();
});
})();
function material_object_callback(rs,handle){
var p_node = handle.getParent('div');
var html = '已选择了1个物料,'+"<a href='javascript:void(0);' onclick='material_selected_show();'>查看关联的物料.</a>";
if ($defined($('hand-selected-product')))
{
$('hand-selected-product').setHTML(html);
} else {
var div = new Element('div',{'html':html,'id':'hand-selected-product'});
div.injectAfter(p_node);
}
}
function material_selected_show(){
new Dialog('index.php?app=material&ctl=admin_material_sales&act=showMaterials',{
ajaxoptions:{data:$('hand-selected-product').getPrevious('div'),method:'post'}
});
}
</script>