<style>
.datagrid-btable, .datagrid-cell{
text-overflow: ellipsis;
}
.li_show{
display:block;
width: 45px;
/* height: 45px; */
background:#FFFFFF;
z-index: 1000;
}
.li_hidden{
display:none;
}
.lichoose1 {
color: #FFF;
background-color: #45B1E0 !important;
}
.lihover1 {
background-color: #23B4F1 !important;
color: #FFF;
}
</style>
<script>
$(function () {
//初始化内容显示区域的高度
$.Sean.intContentBox(BaseH);
var namespace = '{$namespace}';
//选择搜索起始时间
$("#{$namespace}QueryDate").datebox({
prompt:'请选择日期',
onSelect:function (date) {
var dates= date.getFullYear()+"/"+(date.getMonth()+1)+"/"+date.getDate();
// 获取当前时间戳
var timestamp = Date.parse( new Date());
dates = dates.replace(/-/g,'/'); //转化2017-07-08 为2017/07/08
var datestamp = Date.parse(new Date(dates));
if((timestamp-datestamp)<0){
// $.messager.alert('注意','查询日期有误,请重新选择','warning');
//清空日期选择框
$("#{$namespace}QueryDate").datebox('setValue','');
return;
}
}
});
//选择日期截止时间
$("#{$namespace}QueryDate2").datebox({
prompt:'请选择日期',
onSelect:function (date) {
var dates= date.getFullYear()+"/"+(date.getMonth()+1)+"/"+date.getDate();
// 获取当前时间戳
var timestamp = Date.parse( new Date());
dates = dates.replace(/-/g,'/'); //转化2017-07-08 为2017/07/08
var datestamp = Date.parse(new Date(dates));
if((timestamp-datestamp)<0){
// $.messager.alert('注意','查询日期有误,请重新选择','warning');
//清空日期选择框
$("#{$namespace}QueryDate2").datebox('setValue','');
return;
}
}
});
/*//初始化搜索类型
$("#{$namespace}searchcate").combobox({
valueField:'id',
textField:'text',
// url:'__APP__/Api/Dic/getInfo/sign/sslx',
data:[{id:'0',text:'全部'},{id:'1',text:'产品名称'},{id:'2',text:'报价ID'},{id:'3',text:'请购单号'},{id:'4',text:'业务员'}],
prompt:'搜索类型00',
onSelect:function () {
var searchtype =$('#{$namespace}searchcate').combobox('getValue');
if(searchtype == '0') $('#{$namespace}proname').textbox("setValue", "");
}
});*/
//搜索框
var PriceSearchInput = $("#{$namespace}Search").searchbox({
searcher: function (value, name) {
//var pro = $("#out_area").combobox('getValue');
//$("#{$namespace}_hd_name").val(name);
//$("#{$namespace}_hd_value").val(value);
var starttime = $("#{$namespace}QueryDate").datebox('getValue');
var endtime = $("#{$namespace}QueryDate2").datebox('getValue');
var instate =$('#{$namespace}instate').combobox('getValue');
//var searchcate =$('#{$namespace}searchcate').combobox('getValue');
//var proname = $('#{$namespace}proname').textbox('getText');
//起始时间>结束时间 报错
if(starttime && endtime){
// var aa = new Date();
starttime2 = Date.parse(starttime); //转换时间戳
endtime2 = Date.parse(endtime); //转换时间戳
if(starttime2-endtime2>0){
$.messager.alert('注意','起始时间不能大于截止时间','warning');
return;
}
}
console.log(starttime +"/" + endtime +"/" +instate);
$('#{$namespace}inList').datagrid('load', {
json:1,
key: name,
value: value,
starttime: starttime,
endtime: endtime,
instate: instate
//statevalue: pro,
});
},
menu: '#' + namespace + 'SearchType',
prompt: '请输入关键字',
});
//采购入库
$("#{$namespace}inList").datagrid({
collapsible:false,
pagination:true,
nowrap:true,
fitColumns:true,
//url:'__URL__/index/json/1',
method:'get',
columns: [[
{field: 'ruku_id', title: 'ruku_id', hidden:true},
{field: 'updata', title: '请购日期', width: 15, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(value){
return value+ '<br/><a href="#" onclick="cellsearch(\'e.buyer\',\''+row.buyer+'\')">'+ row.buyer+'</a>';
}
}
},
{field: 'q_id', title: '请购单号', width: 15, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(value){
if(row.bjid) return 'Q' + value + '<br/><span style="color:grey;">'+ row.bjid;
else return 'Q' + value;
}
}
},
{field: 'proname', title: '产品名称', width: 30, align: 'left',
formatter:function (value,row,index) {
if(value){
return '<a href="#" onclick="cellsearch(\'e.ProName\',\''+value+'\')" title='+value+'>'+value+'</a>';
}
}
},
{field: 'buysl', title: '请购数量/已入库', width: 15, align: 'right',
formatter:function (value,row,index) {
if(row.num_res) return value +'<br>'+'<span style="color:blue">'+row.num_res+"</span>";
else return value;
}
},
{field: 'area', title: '库存区域', width: 30, align: 'center', halign: 'center',
formatter: function (value, row, index) {
if(row.area_arr){
var area_str = '';
$.each(row.area_arr,function(i,j){
//alert(i + ': ' + j.area);
area_str = area_str ? area_str+'/'+j.area+"<em style='color: grey;'>("+j.realkucun+")</em>" : j.area+"<em style='color: grey;'>("+j.realkucun+")</em>";
});
return "<em title=" + value + ">" + area_str + "</em>";
}else if(value && value!=0) {
return "<em title=" + value + ">" + value + "</em>";
}
}
},
{field: 'realkucun', title: '当前库存', width: 15, align: 'right',
formatter:function (value,row,index) {
if(value && value!=0) {
return value;
}
}
},
{field: 'editor', title: '操作', width: 10, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(row.indepotstate == '完成' || row.pick_status == '未签收') return '--';
else return '<a href="#" onclick="stockIn(' + index +')">采购入库</a>';
}
},
{field: 'print', title: '打印', width: 15, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(row.seanloo_depot1_need_id != '总计:') {
return '<a href="#" onclick="printForm('+index+')">'+'入库单'+'</a> '+
'<a href="#" onclick="printTags('+index+')">'+'标签'+'</a> '+
'<a href="#" onclick="printBarcode(' + index + ')">'+'标签2'+'</a>';
}
/*if(row.seanloo_depot1_need_id != '总计:') {
return '<div onMouseOver="move_choose_print(this)" onMouseOut="out_choose_print(this)" style="position:relative;" name="biaoshidiv" class="print_'+index+'">'+
'<div><a style="color:green;" href="#">'+'请选择'+'</a></div>'+
'<div style="position:absolute;top:18px;left:35px;z-index:1000;" class="li_hidden"><ul style="border: 1px solid green;"><li><a href="#" onclick="printForm('+index+')">'+'入库单'+'</a></li>'+
'<li><a href="#" onclick="printTags('+index+')">'+'标签'+'</a></li>'+
'<li><a href="#" onclick="printBarcode(' + index + ')">'+'标签2'+'</a></li></ul>'+
'</div></div>';
}*/
}
},
]],
//单击入库表,显示选中行产品的历史入库记录
onClickRow: function (index, row) {
$("#{$namespace}inList").datagrid('selectRow',index);
var row = $("#{$namespace}inList").datagrid('getSelected');
if(row){
$("#{$namespace}inHistory").datagrid({
pagination: true,
queryParams: {
q_id:row.q_id,
shadd:row.shadd
},
method: 'post',
url:'__URL__/public_getHistory',
});
};
},
/*
*调用hbrows方法合并同字段单元格
*/
onLoadSuccess: function (data){
//合并单元格
stockIn_hbrows("updata","updata",data);
stockIn_hbrows("buyer","buyer",data);
stockIn_hbrows("q_id","q_id",data);
stockIn_hbrows("proname","proname",data);
stockIn_hbrows("buysl","buysl",data);
stockIn_hbrows("area","area",data);
stockIn_hbrows("realkucun","realkucun",data);
stockIn_hbrows("editor","editor",data);
//鼠标覆盖和离开事件(打印所在列对应事件)
$(".datagrid-row td[field=print] ul li").mouseover(function(){
$(this).addClass("lihover1");
});
$(".datagrid-row td[field=print] ul li").mouseout(function(){
$(this).removeClass("lihover1");
});
/*var remark = $(".datagrid-row td[field=realkucun] div");
//remark.mouseenter(function(e){
remark.mouseover(function(e){
console.log(111222);
var row = $(this).parent('.datagrid-row').attr('datagrid-row-index');
// var info = data['rows'][row];
// var bjid = info['bjid'];
// $.post('__URL__/public_cangkukucun',{'bjid':bjid},function (itme) {
var html = '';
html += "<table>";
html += "<tr><th>库区</th><th>数量</th></tr>";
// delete itme.state;
// for(var i in itme){
html += "<tr><td></td>";
html += "<td></td></tr>";
// }
html += "</table>";
remark.tooltip({
position:'bottom',
content:html,
onShow:function(){
$(this).tooltip('tip').css({
backgroundColor: '',
borderColor: 'blue',
color: 'green',
});
}
});
// }
// ,'json');
});*/
}
}).ColumnMoving(); //表头拖动;
/************************************/
//表头拖动,读取数据,展示保存后的表头排序
<?php if($columns){ ?>
var columns = <?php echo $columns; ?>;
if(columns) {
//获取表格的字段数据
var col = $("#{$namespace}inList").datagrid('options');
var datagrid_column = col.columns;
var arr_col = datagrid_column[0];
var arr = [];
//循环处理数据 field 对应的字段和后台的字段相等时,将该变排序
for (var i = 0; i < arr_col.length; i++) {
for (var j = 0; j < columns.length; j++) {
if (arr_col[i].field == columns[j]) {
arr[j] = arr_col[i];
break;
}
}
}
//赋值,改成datagrid中columns需要的格式
var a_columns = [];
a_columns[0] = arr;
//重新定义datagrid 的columns
$("#{$namespace}inList").datagrid({
columns: a_columns,
}).ColumnMoving();
}
<?php }?>
/************************************/
//退货入库
var Datagrid2 = $("#{$namespace}SellInList");
Datagrid2 .datagrid({
collapsible:false,
pagination:true,
nowrap:true,
fitColumns:true,
//url:'__URL__/public_getSellInList/json/1',
method:'get',
columns: [[
{field: 'ruku_id', title: 'ruku_id', hidden:true},
{field: 'cbhsd_id', title: 'cbhsd_id', hidden:true},
{field: 'updata', title: '签字日期', width: 15, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(row.xsjsr){
return value+ '<br/><a href="#" onclick="SalesReturnCellSearch(\'b.xsjsr\',\''+row.xsjsr+'\')">'+ row.xsjsr+'</a>';
}else{
return value;
}
}
},
{field: 'jkdh_int', title: '缴款单号', width: 15, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(value){
if(row.bjid) return 'C'+value + '<br/><span style="color:grey;">'+ row.bjid;
else return 'C'+value;
}
}
},
{field: 'productname', title: '产品名称', width: 30, align: 'left',
formatter:function (value,row,index) {
if(value){
return '<a href="#" onclick="SalesReturnCellSearch(\'b.productname\',\''+value+'\')" title='+value+'>'+value+'</a>';
}
}
},
{field: 'amount', title: '退货数量/已退货', width: 15, align: 'right',
formatter:function (value,row,index) {
if(row.in_ku_state1 == 0 || row.in_ku_state1 == null) return value;
else return value + '<br/><span style="color:blue;">'+row.amount+'</span>';
}
},
{field: 'area', title: '库存区域', width: 30, align: 'center', halign: 'center',
formatter: function (value, row, index) {
if(row.area_arr){
var area_str = '';
$.each(row.area_arr,function(i,j){
//alert(i + ': ' + j.area);
area_str = area_str ? area_str+'/'+j.area+"<em style='color: grey;'>("+j.realkucun+")</em>" : j.area+"<em style='color: grey;'>("+j.realkucun+")</em>";
});
return "<em title=" + value + ">" + area_str + "</em>";
}else if(value && value!=0) {
return "<em title=" + value + ">" + value + "</em>";
}
}
},
{field: 'realkucun', title: '当前库存', width: 15, align: 'right',
formatter:function (value,row,index) {
if(value && value!=0) {
return value;
}
}
},
{field: 'editor', title: '操作', width: 10, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(row.potclass !=6) {
return '<a href="#" onclick="sellStockIn(' + index +')">退货入库</a>';
}else{
return '--';
}
}
},
{field: 'print', title: '打印', width: 16, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(row.seanloo_depot1_need_id != '总计:') {
return '<a href="#" onclick="printSellForm('+index+')">'+'入库单'+'</a> '+
'<a href="#" onclick="printSellTags('+index+')">'+'标签'+'</a> '+
'<a href="#" onclick="printSellBarcode(' + index + ')">'+'标签2'+'</a> ';
/*return '<div onMouseOver="move_choose_print(this)" onMouseOut="out_choose_print(this)" style="position:relative;" name="biaoshidiv" class="print_'+index+'">'+
'<div><a style="color:green;" href="#">'+'请选择'+'</a></div>'+
'<div style="position:absolute;top:18px;left:35px;z-index:1000;" class="li_hidden"><ul style="border: 1px solid green;"><li><a href="#" onclick="printSellForm('+index+')">'+'入库单'+'</a></li>'+
'<li><a href="#" onclick="printSellTags('+index+')">'+'标签'+'</a></li>'+
'<li><a href="#" onclick="printSellBarcode(' + index + ')">'+'标签2'+'</a></li></ul>'+
'</div></div>';*/
}
}
},
]],
//单击入库表,显示选中行产品的历史入库记录
onClickRow: function (index, row) {
$("#{$namespace}SellInList").datagrid('selectRow',index);
var row = $("#{$namespace}SellInList").datagrid('getSelected');
if(row){
$("#{$namespace}inHistory").datagrid({
pagination: true,
queryParams: {
cbhsd_jkdh:row.jkdh_int,
comid:row.comid
},
method: 'post',
url:'__URL__/public_getSellHistory',
});
};
},
});//表头拖动;
//调拨入库
var Datagrid3 = $("#{$namespace}AllotInList");
Datagrid3 .datagrid({
collapsible:false,
pagination:true,
nowrap:true,
fitColumns:true,
//url:'__URL__/public_getAllotInList/json/1',
method:'get',
columns: [[
{field: 'ruku_id', title: 'ruku_id', hidden:true},
//{field: 'allot_id', title: 'allot_id', hidden:true},
{field: 'updata', title: '调拨日期', width: 15, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(row.username){
return value+ '<br/><a href="#" onclick="AllotReturnCellSearch(\'b.username\',\''+row.username+'\')">'+ row.username+'</a>';
}else{
return value;
}
}
},
{field: 'allot_id', title: '调拨单号', width: 15, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(value){
if (row.bjid) return 'D'+value + '<br/><span style="color: grey;">'+row.bjid+'</span>';
else return 'D'+value;
} else {
if (row.bjid) return '<span style="color: grey;">'+row.bjid+'</span>';
}
}
},
{field: 'productname', title: '产品名称', width: 30, align: 'left',
formatter:function (value,row,index) {
if(value){
return '<a href="#" onclick="AllotReturnCellSearch(\'b.productname\',\''+value+'\')" title='+value+'>'+value+'</a>';
}
}
},
{field: 'amount', title: '调拨数量', width: 15, align: 'right',
formatter:function (value,row,index) {
if(value){
return value;
}
}
},
{field: 'area', title: '库存区域', width: 30, align: 'center', halign: 'center',
formatter: function (value, row, index) {
if(row.area_arr){
var area_str = '';
$.each(row.area_arr,function(i,j){
//alert(i + ': ' + j.area);
area_str = area_str ? area_str+'/'+j.area+"<em style='color: grey;'>("+j.realkucun+")</em>" : j.area+"<em style='color: grey;'>("+j.realkucun+")</em>";
});
return "<em title=" + value + ">" + area_str + "</em>";
}else if(value && value!=0) {
return "<em title=" + value + ">" + value + "</em>";
}
}
},
{field: 'realkucun', title: '当前库存', width: 15, align: 'right',
formatter:function (value,row,index) {
if(value && value!=0) {
return value;
}
}
},
{field: 'editor', title: '操作', width: 10, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(row.potclass !=8) {
return '<a href="#" onclick="allotStockIn('+index+')">调拨入库</a>';
}else{
return '--';
}
}
},
{field: 'print', title: '打印', width: 15, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(row.seanloo_depot1_need_id != '总计:') {
return '<a href="#" onclick="printAllotForm('+index+')">'+'入库单'+'</a> '+
'<a href="#" onclick="printAllotTags('+index+')">'+'标签'+'</a> '+
'<a href="#" onclick="printAllotBarcode(' + index + ')">'+'标签2'+'</a>';
/*return '<div onMouseOver="move_choose_print(this)" onMouseOut="out_choose_print(this)" style="position:relative;" name="biaoshidiv" class="print_'+index+'">'+
'<div><a style="color:green;" href="#">'+'请选择'+'</a></div>'+
'<div style="position:absolute;top:18px;left:35px;z-index:1000;" class="li_hidden"><ul style="border: 1px solid green;"><li><a href="#" onclick="printAllotForm('+index+')">'+'入库单'+'</a></li>'+
'<li><a href="#" onclick="printAllotTags('+index+')">'+'标签'+'</a></li>'+
'<li><a href="#" onclick="printAllotBarcode(' + index + ')">'+'标签2'+'</a></li></ul>'+
'</div></div>';*/
}
}
},
]],
//单击入库表,显示选中行产品的历史入库记录
onClickRow: function (index, row) {
$("#{$namespace}AllotInList").datagrid('selectRow',index);
var row = $("#{$namespace}AllotInList").datagrid('getSelected');
if(row){
$("#{$namespace}inHistory").datagrid({
pagination: true,
queryParams: {
id:row.ruku_id,
},
method: 'post',
url:'__URL__/public_getAllotHistory',
});
};
},
});//表头拖动;
//产品入库历史表
$("#{$namespace}inHistory").datagrid({
idField: 'id',
border: false,
fitColumns: true,
columns:[[
{field: 'indate', title: '入库日期', width: 20, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(value) return '<span style="color: blue;">' + value + '</span>';
}
},
{field: 'potclass', title: '类别', width: 20, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(value) return '<span style="color: blue;">' + value + '</span>';
}
},
{field: 'depotno', title: '单号', width: 20, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(value) return '<span style="color: blue;">' + value + '</span>';
}
},
{field: 'price', title: '单价', width: 20, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(value) return '<span style="color: blue;">' + Number(value).toFixed(2) + '</span>';
}
},
{field: 'quantity', title: '入库数量', width: 20, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(value) return '<span style="color: blue;">' + value + '</span>';
}
},
{field: 'amount', title: '金额', width: 20, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(value) return '<span style="color: blue;">' + Number(value).toFixed(2) + '</span>';
}
},
{field: 'addmen', title: '收货人', width: 20, align: 'center', halign: 'center',
formatter:function (value,row,index) {
if(value) return '<span style="color: blue;">' + value + '</span>';
}
}
]],
});
//让特定的tab处于选中状态
//var tab = $('#sean-layout-tabs').tabs('getTab','退货入库信息');
$('#{$namespace}TabsContent').tabs({
//tab:tab,
onSelect:function(title){
//$('#{$namespace}proname').textbox();//解决.textbox()报错的问题
//初始化搜索栏日期选择
$("#{$namespace}QueryDate").datebox('setValue','<?php echo date('Y-m-d',time()-3600*24*365*2)?>');
$("#{$namespace}QueryDate2").datebox('setValue','<?php echo date('Y-m-d',time())?>');
//清空入库历史
$('#{$namespace}inHistory').datagrid('loadData', { total: 0, rows: [] });
var data = list_id = search_id = type_id = url = '';
if(title=='采购入库信息'){
//var tab = $('#sean-layout-tabs').tabs('getTab','采购入库信息');
$("#hd_tab").val(title);
//初始化搜索类型
data =[{id:'0',text:'全部'},{id:'1',text:'产品名称'},{id:'2',text:'报价ID'},{id:'3',text:'请购单号'},{id:'4',text:'采购员'}],
$("#inList_search").attr("style","");
$("#SellInList_search").attr("style","display: none;");
$("#AllotInList_search").attr("style","display: none;");
//初始化入库状态
list_id = "#{$namespace}inList";
search_id = "#{$namespace}Search";
type_id = "#{$namespace}SearchType";
url = '__URL__/public_searchBar';
hiddenField(list_id);//自定义隐藏字段
//点击搜索操作
StockInSearch(list_id,search_id,type_id);
/* $('#{$namespace}Search').unbind('click');
$('#{$namespace}Search').bind('click', function () {
StockInSearch(list_id, url);
});*/
}else if(title=='退货入库信息'){
$("#hd_tab").val(title);
//初始化搜索类型
data = [{id:'0',text:'全部'},{id:'1',text:'产品名称'},{id:'2',text:'报价ID'},{id:'3',text:'缴款单号'},{id:'4',text:'退货数量'},{id:'5',text:'业务员'}];
$("#inList_search").attr("style","display: none;");
$("#SellInList_search").attr("style","");
$("#AllotInList_search").attr("style","display: none;");
//初始化入库状态
list_id = "#{$namespace}SellInList";
search_id = "#SellInList_Search";
type_id = "#SellInList_SearchType";
url = '__URL__/public_SellSearchBar';
hiddenField(list_id);//自定义隐藏字段
//点击搜索操作
StockInSearch(list_id,search_id,type_id);
/*$('#{$namespace}Search').unbind('click');
$('#{$namespace}Search').bind('click', function () {
StockInSearch(list_id, url);
});*/
}else{
$("#hd_tab").val(title);
//初始化搜索类型
data = [{id:'0',text:'全部'},{id:'1',text:'产品名称'},{id:'2',text:'报价ID'},{id:'4',text:'调拨数量'},{id:'5',text:'业务员'}];
$("#inList_search").attr("style","display: none;");
$("#SellInList_search").attr("style","display: none;");
$("#AllotInList_search").attr("style","");
//初始化入库状态
list_id = "#{$namespace}AllotInList";
search_id = "#AllotInList_Search";
type_id = "#AllotInList_SearchType";
url = '__URL__/public_AllotSearchBar';
hiddenField(list_id);//自定义隐藏字段
//点击搜索操作
StockInSearch(list_id,search_id,type_id);
/*$('#{$namespace}Search').unbind('click');
$('#{$namespace}Search').bind('click', function () {
StockInSearch(list_id, url);
});*/
}
//初始化搜索类型
/*$("#{$namespace}searchcate").combobox({
valueField:'id',
textField:'text',
// url:'__APP__/Api/Dic/getInfo/sign/sslx',
data:data,
prompt:'搜索类型',
onSelect:function () {
var searchtype =$('#{$namespace}searchcate').combobox('getValue');
if(searchtype == '0') $('#{$namespace}proname').textbox("setValue", "");
}
});*/
//初始化入库状态
$("#{$namespace}instate").combobox({
valueField:'id',
textField:'text',
data:[{id:'1',text:'未入库'},{id:'2',text:'已入库'}],
prompt:'入库状态',
onLoadSuccess: function () { //数据加载完毕事件,下拉框默认选择第一项
var val = $("#{$namespace}instate").combobox("getData");
for(var i=0,len=val.length;i<len;i++){
for(var key in val[i]){
if (val[i][key] == "未入库") {
$(this).combobox("select", 1);
}
}
}
},
onSelect:function (date) {
var starttime = $("#{$namespace}QueryDate").datebox('getValue');
var endtime = $("#{$namespace}QueryDate2").datebox('getValue');
var instate =$('#{$namespace}instate').combobox('getValue');
//var searchcate =$('#{$namespace}searchcate').combobox('getValue');
//var proname = $('#{$namespace}proname').textbox('getValue');
var tab = $("#hd_tab").val();
if(tab == '退货入库信息'){
if(instate == 1) {
type_id = "#SellInList_SearchType";
var html = '<div id="SellInList_SearchType">' +
' <div data-options="name:\'b.Jkdh_int\'">缴款单号</div>' +
' <div data-options="name:\'b.bjid\'">报价ID</div>' +
' <div data-options="name:\'b.ProductName\'">产品名称</div>' +
' <div data-options="name:\'b.Xsjsr\'">业务员</div>' +
' <div data-options="name:\'b.Amount\'">退货数量</div>' +
' </div>';
$("#SellInList_SearchType_already").remove();
$("#{$namespace}instate").prepend(html);
} else{
type_id = "#SellInList_SearchType_already";
var html = '<div id="SellInList_SearchType_already">' +
' <div data-options="name:\'b.cbhsd_jkdh\'">缴款单号</div>' +
' <div data-options="name:\'b.bjid\'">报价ID</div>' +
' <div data-options="name:\'c.ProName\'">产品名称</div>' +
' <div data-options="name:\'b.ProUser\'">业务员</div>' +
' <div data-options="name:\'b.Quantity\'">退货数量</div>' +
' </div>';
$("#SellInList_SearchType").remove();
$("#{$namespace}instate").prepend(html);
}
}else if(tab == '调拨入库信息'){
if(instate == 1) {
type_id = "#AllotInList_SearchType";
var html = '<div id="AllotInList_SearchType">'+
'<div data-options="name:\'b.priceid\'">报价ID</div>'+
'<div data-options="name:\'b.ProductName\'">产品名称</div>'+
'<div data-options="name:\'b.username\'">业务员</div>'+
'<div data-options="name:\'b.mount\'">调拨数量</div>'+
'</div>';
$("#AllotInList_SearchType_already").remove();
$("#{$namespace}instate").prepend(html);
} else{
type_id = "#AllotInList_SearchType_already";
var html = '<div id="AllotInList_SearchType_already">'+
'<div data-options="name:\'b.bjid\'">报价ID</div>'+
'<div data-options="name:\'b.ProName\'">产品名称</div>'+
'<div data-options="name:\'b.ProUser\'">业务员</div>'+
'<div data-options="name:\'b.Quantity\'">调拨数量</div>'+
'</div>';
$("#AllotInList_SearchType").remove();
$("#{$namespace}instate").prepend(html);
}
}
StockInSearch(list_id,search_id,type_id);
//切换入库状态,判断搜索类型有无关键字
/*if(proname){
//入库状态与日期,入库类型关联查询
$(list_id).datagrid({
url: url,
queryParams: {
starttime: starttime,
endtime: endtime,
instate: instate,
//searchcate: searchcate,
proname: proname
},
method: 'post'
});
}else{*/
//$('#{$namespace}searchcate').combobox("select", 0);
//入库状态与日期,入库类型关联查询
$(list_id).datagrid({
url: url,
queryParams: {
starttime: starttime,
endtime: endtime,
instate: instate,
},
method: 'post'
});
//}
}
});
//重载事件
$('#{$namespace}Reload').bind('click', function () {
// var currentTab = $('#{$namespace}TabsContent').tabs('getSelected');
// RefreshTab(currentTab, list_id, url, title);//刷新当前标签Tabs
// $(list_id).datagrid('reload');
$.Sean.refreshTabs();//刷新整个页面
});
}
});
});
//刷新当前标签Tabs
function RefreshTab(currentTab, list_id, url, title) {
/*//让特定的tab处于选中状态
var tab = $('#{$namespace}TabsContent').tabs('getTab', title);
$('#{$namespace}TabsContent').tabs('update', {
tab: tab,
options: {
title: title,
href:url
}
});
//显示指定的tabs
$('#{$namespace}TabsContent').tabs('select', title);*/
//var url = $(currentTab.panel('options')).attr('href');
$('#{$namespace}TabsContent').tabs('update', {
tab: currentTab,
options: {
title: title,
href: url
}
});
currentTab.panel('refresh');
}
//采购入库:点击产品名称、业务员搜索
function cellsearch(field,value){
var instate =$('#{$namespace}instate').combobox('getValue');
var Datagrid = $("#{$namespace}inList");
Datagrid.datagrid('load',{
instate:instate,
field: field,
value: value
});
}
//采购入库
function stockIn(index) {
var Datagrid = $("#{$namespace}inList");
Datagrid.datagrid('selectRow',index);
var row = Datagrid.datagrid('getSelected');//取得选中行数据
if (row) {
var param = {
url: '__URL__/stockIn/id/'+row.q_id+'/bjid/'+row.bjid+'/shadd/'+row.shadd,
title: '采购入库操作',
size: '380|240',
};
$.Sean.CreateDialog(param);
} else {
$.messager.alert('提示', '请选择需要入库的记录!', 'warning');
}
}
//退货入库
function sellStockIn(index) {
var Datagrid = $("#{$namespace}SellInList");
Datagrid.datagrid('selectRow',index);
var row = Datagrid.datagrid('getSelected');//取得选中行数据
if (row) {
var param = {
url: '__URL__/SellStockIn/id/'+row.cbhsd_id+'/bjid/'+row.bjid+'/fhadd/'+row.fhadd,
title: '退货入库操作',
size: '380|240',
};
$.Sean.CreateDialog(param);
} else {
$.messager.alert('提示', '请选择需要入库的记录!', 'warning');
}
}
//调拨入库
function allotStockIn(index) {
var Datagrid = $("#{$namespace}AllotInList");
Datagrid.datagrid('selectRow',index);
var row = Datagrid.datagrid('getSelected');//取得选中行数据
if (row) {
var param = { //encodeURI(encodeURI(row.area)):处理汉字 encodeURIComponent(encodeURIComponent(row.area)):处理汉字和特殊字符组合
url: '__URL__/AllotStockIn/id/'+row.allot_id+'/bjid/'+row.bjid+'/toareaid/'+row.toareaid+'/fromareaid/'+row.fromareaid+'/fromarea/'+encodeURIComponent(encodeURIComponent(row.fromarea)),
title: '调拨入库操作',
size: '380|240',
};
$.Sean.CreateDialog(param);
} else {
$.messager.alert('提示', '请选择需要入库的记录!', 'warning');
}
}
//公共方法:入库单搜索栏
function StockInSearch(list_id, search_id,type_id){
//搜索框
var PriceSearchInput = $(search_id).searchbox({
searcher: function (value, name) {
//var pro = $("#out_area").combobox('getValue');
//$("#{$namespace}_hd_name").val(name);
//$("#{$namespace}_hd_value").val(value);
var starttime = $("#{$namespace}QueryDate").datebox('getValue');
var endtime = $("#{$namespace}QueryDate2").datebox('getValue');
var instate =$('#{$namespace}instate').combobox('getValue');
//var searchcate =$('#{$namespace}searchcate').combobox('getValue');
//var proname = $('#{$namespace}proname').textbox('getText');
//起始时间>结束时间
if(starttime && endtime){
// var aa = new Date();
starttime2 = Date.parse(starttime); //转换时间戳
endtime2 = Date.parse(endtime); //转换时间戳
if(starttime2-endtime2>0){
$.messager.alert('注意','起始时间不能大于截止时间','warning');
return;
}
}
//console.log(starttime +"/" + endtime +"/" +instate);
$(list_id).datagrid('load', {
json:1,
key: name,
value: value,
starttime: starttime,
endtime: endtime,
instate: instate
//statevalue: pro,
});
},
menu: type_id,
prompt: '请输入关键字',
});
/*//点击搜索操作
//$('#{$namespace}Search').bind('click', function () {
var starttime = $("#{$namespace}QueryDate").datebox('getValue');
var endtime = $("#{$namespace}QueryDate2").datebox('getValue');
var instate =$('#{$namespace}instate').combobox('getValue');
//var searchcate =$('#{$namespace}searchcate').combobox('getValue');
//var proname = $('#{$namespace}proname').textbox('getText');
//起始时间>结束时间 报错
if(starttime && endtime){
// var aa = new Date();
starttime2 = Date.parse(starttime); //转换时间戳
endtime2 = Date.parse(endtime); //转换时间戳
if(starttime2-endtime2>0){
$.messager.alert('注意','起始时间不能大于截止时间','warning');
return;
}
}
/!*if(proname!=''){
if(searchcate==''){
$.messager.alert('提示', '搜索类型不能为空', 'warning');
return;
}
}
if(searchcate!='' && searchcate !='0'){
if(proname==''){
$.messager.alert('提示', '请输入数据', 'warning');
return;
}
}*!/
$(list_id).datagrid({
pagination: true,
queryParams: {
starttime: starttime,
endtime: endtime,
instate:instate,
//searchcate:searchcate,
//proname:proname
},
method: 'post',
//url: '__URL__/public_AllotSearchBar'
url: url
});
//});*/
}
//退货入库:点击产品名称、业务员搜索
function SalesReturnCellSearch(field,value){
var instate =$('#{$namespace}instate').combobox('getValue');
//入库状态、入库类型关联查询
$("#{$namespace}SellInList").datagrid({
url: '__URL__/public_SellSearchBar',
queryParams: {
instate:instate,
field: field,
value: value
},
method: 'post'
});
}
//退货入库:点击产品名称、业务员搜索
function AllotReturnCellSearch(field,value){
var instate =$('#{$namespace}instate').combobox('getValue');
//入库状态、入库类型关联查询
$("#{$namespace}AllotInList").datagrid({
url: '__URL__/public_AllotSearchBar',
queryParams: {
instate:instate,
field: field,
value: value
},
method: 'post'
});
}
//鼠标覆盖事件
function move_choose_print(obj){
$("div[name='biaoshidiv']").parent().css("overflow","visible");
$(obj).children("div").eq(1).removeClass('li_hidden');
$(obj).children("div").eq(1).addClass('li_show');
}
//鼠标离开事件
function out_choose_print(obj){
$(obj).children("div").eq(1).removeClass('li_show');
$(obj).children("div").eq(1).addClass('li_hidden');
}
//采购打印入库单
function printForm (index) {
var Datagrid = $("#{$namespace}inList");
Datagrid.datagrid('selectRow',index);
var row = Datagrid.datagrid('getSelected');//取得选中行数据
//有多条入库数据,一次打印多张入库单
var id = '';
if(row.data){
$.each(row.data, function(m,n){
id = id ? id+","+n.ruku_id : n.ruku_id;
});
}else id = row.ruku_id;
if (id){
//弹出打印确认对话框
var param = {
id:'printStockIn',
url: '__URL__/public_printForm/id/' + id,
title: '打印入库单',
size: '600|auto',//对话框的宽高
buttons:[
{text:'打印预览',id: 'submitId',iconCls:'icon-printer_add',handler:function () {
$('#printStockIn').print();
}},
{text:'取消打印',iconCls:'icon-printer',handler:function(){
$('#printStockIn').dialog('destroy');
}}
]
};
$.Sean.CreateDialog(param);
} else {
$.messager.alert('提示', '采购未入库的记录不能打印入库单!', 'warning');
}
}
//销售打印入库单
function printSellForm (index) {
var Datagrid = $("#{$namespace}SellInList");
Datagrid.datagrid('selectRow',index);
var row = Datagrid.datagrid('getSelected');//取得选中行数据
//有多条入库数据,一次打印多张入库单
var id = '';
if(row.data){
$.each(row.data, function(m,n){
id = id ? id+","+n.ruku_id : n.ruku_id;
});
}else id = row.ruku_id;
if (id){
//弹出打印确认对话框
var param = {
id:'printStockIn',
url: '__URL__/public_printForm/id/' + id,
title: '打印入库单',
size: '600|auto',//对话框的宽高
buttons:[
{text:'打印预览',id: 'submitId',iconCls:'icon-printer_add',handler:function () {
$('#printStockIn').print();
}},
{text:'取消打印',iconCls:'icon-printer',handler:function(){
$('#printStockIn').dialog('destroy');
}}
]
};
$.Sean.CreateDialog(param);
} else {
$.messager.alert('提示', '退货未入库的记录不能打印入库单!', 'warning');
}
}
//调拨打印入库单
function printAllotForm (index) {
var Datagrid = $("#{$namespace}AllotInList");
Datagrid.datagrid('selectRow',index);
var row = Datagrid.datagrid('getSelected');//取得选中行数据
//有多条入库数据,一次打印多张入库单
var id = '';
if(row.data){
$.each(row.data, function(m,n){
id = id ? id+","+n.ruku_id : n.ruku_id;
});
}else id = row.ruku_id;
if (id){
//弹出打印确认对话框
var param = {
id:'printStockIn',
url: '__URL__/public_printForm/id/' + id,
title: '打印入库单',
size: '600|auto',//对话框的宽高
buttons:[
{text:'打印预览',id: 'submitId',iconCls:'icon-printer_add',handler:function () {
$('#printStockIn').print();
}},
{text:'取消打印',iconCls:'icon-printer',handler:function(){
$('#printStockIn').dialog('destroy');
}}
]
};
$.Sean.CreateDialog(param);
} else {
$.messager.alert('提示', '调拨未入库的记录不能打印入库单!', 'warning');
}
}
//采购打印标签
function printTags (index) {
var Datagrid = $("#{$namespace}inList");
Datagrid.datagrid('selectRow',index);
var row = Datagrid.datagrid('getSelected');//取得选中行数据
if (row){
//弹出打印确认对话框
var param = { //encodeURI(encodeURI(row.area)):处理汉字
id:'printStockTags', //encodeURIComponent(encodeURIComponent(row.area)):处理汉字和特殊字符组合
//url: '__URL__/printTags/id/' + row.q_id+'/area/'+encodeURIComponent(encodeURIComponent(row.area)),
url: '__URL__/printTags/id/' + row.q_id,
title: '打印标签',
size: '400|400',//对话框的宽高
buttons:[
{text:'打印预览',id: 'submitId',iconCls:'icon-printer_add',handler:function () {
$('#printStockTags').print();
}},
{text:'取消打印',iconCls:'icon-printer',handler:function(){
$('#printStockTags').dialog('destroy');
}}
]
};
$.Sean.CreateDialog(param);
}
}
//销售打印标签
function printSellTags (index) {
var Datagrid = $("#{$namespace}SellInList");
Datagrid.datagrid('selectRow',index);
var row = Datagrid.datagrid('getSelected');//取得选中行数据
if (row){
//弹出打印确认对话框
var param = {
id:'printStockTags',
url: '__URL__/printSellTags/id/' + row.cbhsd_id,
title: '打印标签',
size: '350|350',//对话框的宽高
buttons:[
{text:'打印预览',id: 'submitId',iconCls:'icon-printer_add',handler:function () {
$('#printStockTags').print();
}},
{text:'取消打印',iconCls:'icon-printer',handler:function(){
$('#printStockTags').dialog('destroy');
}}
]
};
$.Sean.CreateDialog(param);
}
}
//调拨打印标签
function printAllotTags (index) {
var Datagrid = $("#{$namespace}AllotInList");
Datagrid.datagrid('selectRow',index);
var row = Datagrid.datagrid('getSelected');//取得选中行数据
if (!row.checkstatus){
//if (row){
//弹出打印确认对话框
var param = {
id:'printStockTags',
url: '__URL__/printAllotTags/id/' + row.allot_id+'/checkstatus/'+row.checkstatus,
title: '打印标签',
size: '350|350',//对话框的宽高
buttons:[
{text:'打印预览',id: 'submitId',iconCls:'icon-printer_add',handler:function () {
$('#printStockTags').print();
}},
{text:'取消打印',iconCls:'icon-printer',handler:function(){
$('#printStockTags').dialog('destroy');
}}
]
};
$.Sean.CreateDialog(param);
}else {
$.messager.alert('提示', '调拨未入库的记录不能打印标签!', 'warning');
}
}
//采购打印条形码标签
function printBarcode(index) {
var Datagrid = $("#{$namespace}inList");
Datagrid.datagrid('selectRow',index);
var row = Datagrid.datagrid('getSelected');//取得选中行数据
if (row){
//弹出打印确认对话框
var param = {
id:'printStockTags',
url: '__URL__/printTags/type/'+ 1 +'/id/' + row.q_id,
title: '打印标签',
size: '260|445',//对话框的宽高
buttons:[
{text:'打印预览',id: 'submitId',iconCls:'icon-printer_add',handler:function () {
$('#printStockTags').print();
}},
{text:'取消打印',iconCls:'icon-printer',handler:function(){
$('#printStockTags').dialog('destroy');
}}
]
};
$.Sean.CreateDialog(param);
}
}
//销售打印条形码标签
function printSellBarcode(index) {
var Datagrid = $("#{$namespace}SellInList");
Datagrid.datagrid('selectRow',index);
var row = Datagrid.datagrid('getSelected');//取得选中行数据
if (row){
//弹出打印确认对话框
var param = {
id:'printStockTags',
url: '__URL__/printSellTags/type/'+ 1 +'/id/' + row.cbhsd_id,
title: '打印标签',
size: '260|445',//对话框的宽高
buttons:[
{text:'打印预览',id: 'submitId',iconCls:'icon-printer_add',handler:function () {
$('#printStockTags').print();
}},
{text:'取消打印',iconCls:'icon-printer',handler:function(){
$('#printStockTags').dialog('destroy');
}}
]
};
$.Sean.CreateDialog(param);
}
}
//调拨打印条形码标签
function printAllotBarcode(index) {
var Datagrid = $("#{$namespace}AllotInList");
Datagrid.datagrid('selectRow',index);
var row = Datagrid.datagrid('getSelected');//取得选中行数据
if (!row.checkstatus){
//弹出打印确认对话框
var param = {
id:'printStockTags',
url: '__URL__/printAllotTags/type/'+ 1 +'/id/' + row.allot_id,
title: '打印标签',
size: '260|445',//对话框的宽高
buttons:[
{text:'打印预览',id: 'submitId',iconCls:'icon-printer_add',handler:function () {
$('#printStockTags').print();
}},
{text:'取消打印',iconCls:'icon-printer',handler:function(){
$('#printStockTags').dialog('destroy');
}}
]
};
$.Sean.CreateDialog(param);
}else {
$.messager.alert('提示', '调拨未入库的记录不能打印标签!', 'warning');
}
}
//自定义隐藏字段
function hiddenField(list_id){
/******************************/
$(list_id).parent().parent().children(':first').on('click','.datagrid-header-rownumber',function (e, field) {
//e:当前事件的对象信息
//field:当前点击的字段
id=list_id.replace('#','');
var param = {};
param.module = '<?php echo $module['module'] ?>';
param.controller = '<?php echo $module['controller'] ?>';
param.action = '<?php echo $module['action'] ?>';
param.id = id;
param.url = '__ACTION__/ajax/1';
var data = '<?php echo json_encode($module['data']); ?>';
data = eval('(' + data + ')');
param.data = data;
param.e = e;
$(list_id).ColumnSet({param: param});
});
/******************************/
//加载页面是判断哪些不显示的
<?php foreach ($module['data'] as $k=>$v)
{ ?>
var field = '<?php echo $v['field']?>';
$(list_id).datagrid('hideColumn', field);
<?php } ?>
}
//合并相同字段
function stockIn_hbrows(field1,field2,data){
for (var i=1; i <data.rows.length; i++) {
if (data.rows[i][field1] == data.rows[i-1][field1]&&data.rows[i]['q_id'] == data.rows[i-1]['q_id']&&data.rows[i]['q_id']!=null) {
//注意datagrid_id是否正确
var datagrid_id = 'WarehouseStockInStockBox';
$('#WarehouseStockInStockBox').find('.datagrid-btable tr[datagrid-row-index="'+(i-1)+'"] td[field="'+field2+'"]').css("border-width", "0px 1px 0px 0px");
$('#WarehouseStockInStockBox').find('.datagrid-btable tr[datagrid-row-index="'+i+'"] td[field="'+field2+'"]').text("");
}
}
}
/*
* 封装需要合并的同字段单元格方法
* 直接传入要合并的相同字段名和data
* */
function hbrows(field,data){
var mark =1;
for (var i=1; i <data.rows.length; i++) {
if (data.rows[i][field] == data.rows[i-1][field]&&data.rows[i]['q_id'] == data.rows[i-1]['q_id']&&data.rows[i]['q_id']!=null) {
mark ++;
$("#{$namespace}inList").datagrid('mergeCells',{
index: i+1-mark,
field: field,
rowspan:mark
});
}else{
mark=1;
}
}
}
</script>
<div class="content" id="{$namespace}StockBox">
<div class="easyui-layout" data-options="fit:true,border:false">
<div data-options="region:'north',split:false,collapsible:false" style="height:30px">
<div id="{$namespace}ToolBar">
<input id="biaoji" type="hidden" value="">
<input type="hidden" id="hd_tab" value="">
<table cellspacing="0" cellpadding="0">
<tr>
<td><a href="javascript:;" class="easyui-linkbutton" id="{$namespace}Reload"
data-options="iconCls:'icon-arrow_rotate_clockwise',plain:true" style="height:25px">重载</a>
</td>
<td><div class="datagrid-btn-separator"></div></td>
<td>
起始时间:<input id="{$namespace}QueryDate" type="text" value="<?php echo date('Y-m-d',time()-3600*24*365*2)?>" class="easyui-datebox" style=" height:25px;width:120px;">
</td>
<td><div class="datagrid-btn-separator"></div></td>
<td>
截止时间:<input id="{$namespace}QueryDate2" type="text" value="<?php echo date('Y-m-d',time())?>" class="easyui-datebox" style=" height:25px;width:120px;">
</td>
<td>
<div class="datagrid-btn-separator"></div>
</td>
<td><input id="{$namespace}instate" style="height:25px;width:70px"></td>
<td>
<div class="datagrid-btn-separator"></div>
</td>
<!--<td><input id="{$namespace}searchcate" style="height:25px;width:80px"></td>
<td>
<div class="datagrid-btn-separator"></div>
</td>
<td>
<input id="{$namespace}proname" class=""easyui-textbox" name="proname" style="height:25px;width:150px;" value=''/>
</td>-->
<!--<td>
<div class="datagrid-btn-separator"></div>
</td>-->
<!--<td><a href="javascript:;" class="easyui-linkbutton" id="{$namespace}Search"
data-options="iconCls:'icon-search_accounts',plain:true" style="height:25px">搜索</a>
</td>-->
<td id="inList_search">
<input id="{$namespace}Search" style="width: 300px;">
<div id="{$namespace}SearchType">
<div data-options="name:'e.ID'">请购单号</div>
<div data-options="name:'e.bjid'">报价ID</div>
<div data-options="name:'e.ProName'">产品名称</div>
<div data-options="name:'e.Buyer'">采购员</div>
</div>
</td>
<td id="SellInList_search" style="display: none;">
<input id="SellInList_Search" style="width: 300px;">
<div id="SellInList_SearchType">
<div data-options="name:'b.Jkdh_int'">缴款单号</div>
<div data-options="name:'b.bjid'">报价ID</div>
<div data-options="name:'b.ProductName'">产品名称</div>
<div data-options="name:'b.Xsjsr'">业务员</div>
<div data-options="name:'b.Amount'">退货数量</div>
</div>
</td>
<td id="AllotInList_search" style="display: none;">
<input id="AllotInList_Search" style="width: 300px;">
<div id="AllotInList_SearchType">
<div data-options="name:'e.bjid'">报价ID</div>
<div data-options="name:'e.ProName'">产品名称</div>
<div data-options="name:'e.Buyer'">业务员</div>
<div data-options="name:'e.ID'">调拨数量</div>
</div>
</td>
<!--<td><span style="margin-left: 10px;color: #444;">(单击一行数据显示入库历史)</span>
</td>-->
</tr>
</table>
</div>
</div>
<!-- <div class="content" id="{$namespace}ContentBox">
<div class="easyui-layout" data-options="fit:true,border:false" style="width:100%;height:100%;">-->
<div data-options="region:'center',split:false" style="height: 65%;">
<div class="easyui-tabs" id="{$namespace}TabsContent" data-options="fit:true,border:false">
<div data-options="region:'center',title:'采购入库信息'">
<table id="{$namespace}inList">
</table>
</div>
<div data-options="region:'center',title:'退货入库信息'">
<table id="{$namespace}SellInList" style="display: none"></table>
</div>
<div data-options="region:'center',title:'调拨入库信息'">
<table id="{$namespace}AllotInList" style="display: none"></table>
</div>
</div>
</div>
<div id="history" data-options="region:'south',title:'入库信息历史',split:true,collapse:true" style="height:35%;">
<table id="{$namespace}inHistory">
</table>
</div>
<!-- </div>
</div>-->
</div>
</div>
版权声明:本文为qq_38666502原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接和本声明。