优化7张进销存录入单据

This commit is contained in:
季圣华 2017-01-08 16:17:24 +08:00
parent e360811ec4
commit 66d4b2fcf2
7 changed files with 31 additions and 4484 deletions

View File

@ -311,7 +311,8 @@
var rowInfo = rec.Id + 'AaBb' + rec.ProjectId+ 'AaBb' + rec.Number+ 'AaBb' + rec.OperPersonName
+ 'AaBb' + rec.OperTime+ 'AaBb' + rec.OrganId+ 'AaBb' + rec.HandsPersonId
+ 'AaBb' + rec.AccountId+ 'AaBb' + rec.ChangeAmount+ 'AaBb' + rec.Remark
+ 'AaBb' + rec.ProjectName+ 'AaBb' + rec.OrganName+ 'AaBb' + rec.HandsPersonName+ 'AaBb' + rec.AccountName + 'AaBb' + rec.TotalPrice;
+ 'AaBb' + rec.ProjectName+ 'AaBb' + rec.OrganName+ 'AaBb' + rec.HandsPersonName
+ 'AaBb' + rec.AccountName + 'AaBb' + rec.TotalPrice + 'AaBb' + rec.AllocationProjectId + 'AaBb' + rec.AllocationProjectName;
if(1 == value)
{
str += '<img src="' + path + '/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showDepotHead(\'' + rowInfo + '\');"/>&nbsp;<a onclick="showDepotHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">查看</a>&nbsp;&nbsp;';
@ -662,7 +663,7 @@
$("#ChangeAmount").attr("data-changeamount", depotHeadInfo[8]);
$("#Remark").val(depotHeadInfo[9]);
var TotalPrice = depotHeadInfo[14];
$("#AllocationProjectId").val(depotHeadInfo[15]);
//orgDepotHead = depotHeadInfo[1];
var editTitle = listTitle.replace("列表","信息");
$('#depotHeadDlg').dialog('open').dialog('setTitle','<img src="' + path + '/js/easyui-1.3.5/themes/icons/pencil.png"/>&nbsp;编辑' + editTitle);
@ -686,6 +687,7 @@
$("#ChangeAmountShow").text(depotHeadInfo[8]);
$("#RemarkShow").text(depotHeadInfo[9]);
var TotalPrice = depotHeadInfo[14];
$("#AllocationProjectIdShow").text(depotHeadInfo[16]);
var showTitle = listTitle.replace("列表","信息");
$('#depotHeadDlgShow').dialog('open').dialog('setTitle','<img src="' + path + '/js/easyui-1.3.5/themes/icons/list.png"/>&nbsp;查看' + showTitle);
$(".window-mask").css({ width: webW ,height: webH});
@ -737,6 +739,13 @@
return;
else
{
var OrganId = null, AllocationProjectId = null;
if(listSubType !=="调拨"){
OrganId = $('#OrganId').combobox('getValue');
}
else {
AllocationProjectId = $.trim($("#AllocationProjectId").val()); //收货仓库-对方
}
$.ajax({
type:"post",
url: url,
@ -745,10 +754,11 @@
data: ({
Type: listType,
SubType: listSubType,
ProjectId : $.trim($("#ProjectId").val()),
Number : $.trim($("#Number").val()),
ProjectId: $.trim($("#ProjectId").val()),
AllocationProjectId: AllocationProjectId,
Number: $.trim($("#Number").val()),
OperTime: $("#OperTime").val(),
OrganId: $('#OrganId').combobox('getValue'),
OrganId: OrganId,
HandsPersonId: $.trim($("#HandsPersonId").val()),
AccountId: $.trim($("#AccountId").val()),
ChangeAmount: $.trim($("#ChangeAmount").val()),
@ -760,18 +770,25 @@
{
if(tipInfo)
{
function closeDialog(){
$('#depotHeadDlg').dialog('close');
var opts = $("#tableData").datagrid('options');
showDepotHeadDetails(opts.pageNumber,opts.pageSize);
}
//保存明细记录
if(depotHeadID ==0)
{
getMaxId(); //查找最大的Id
accept(depotHeadMaxId); //新增
changeAmountFn(); //改变账户金额
//changeAmountFn(); //改变账户金额
closeDialog();
}
else
{
accept(depotHeadID); //修改
changeAmountFn(); //改变账户金额
}
//changeAmountFn(); //改变账户金额
closeDialog();
}
}
else
{
@ -1047,9 +1064,7 @@
currentAmount: currentAmount + ChangeAmount - oldChangeAmount
},
success: function(res){
$('#depotHeadDlg').dialog('close');
var opts = $("#tableData").datagrid('options');
showDepotHeadDetails(opts.pageNumber,opts.pageSize);
},
error:function(){
$.messager.alert('提示','请检查网络连接!','error');

View File

@ -157,897 +157,5 @@
</tr>
</table>
</div>
<script type="text/javascript">
return;
var depotList = null;
var depotID = null;
var supplierList = null;
var supplierID = null;
var personList = null;
var personID = null;
var ProjectSearch=null;
var kid=${sessionScope.user.id};
var userBusinessList=null;
var userdepot=null;
var depotHeadMaxId=null; //获取最大的Id
var accepId=null; //保存的主表id
//初始化界面
$(function()
{
//初始化系统基础信息
initSystemData_UB();
initSelectInfo_UB();
initSystemData_depot();
initSelectInfo_depot();
initSupplier(); //供应商
initTableData();
ininPager();
initForm();
});
//初始化系统基础信息
function initSystemData_UB()
{
$.ajax({
type:"post",
url: "<%=path%>/userBusiness/getBasicData.action",
data: ({
KeyId:kid,
Type:"UserDepot"
}),
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
if(systemInfo)
{
userBusinessList = systemInfo.showModel.map.userBusinessList;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找UserBusiness异常,请与管理员联系!','error');
return;
}
}
else
{
userBusinessList=null;
}
}
});
}
//初始化页面选项卡
function initSelectInfo_UB()
{
if(userBusinessList !=null)
{
if(userBusinessList.length>0)
{
//用户对应的部门列表 [1][2][3]...
userdepot =userBusinessList[0].value;
}
}
}
//初始化系统基础信息
function initSystemData_depot()
{
$.ajax({
type:"post",
url: "<%=path%>/depot/getBasicData.action",
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
depotList = systemInfo.showModel.map.depotList;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找系统基础信息异常,请与管理员联系!','error');
return;
}
}
});
}
//初始化页面选项卡
function initSelectInfo_depot()
{
var options = "";
var alloptions = "";
if(depotList !=null)
{
options = "";
for(var i = 0 ;i < depotList.length;i ++)
{
var depot = depotList[i];
if(userdepot!=null)
{
if(userdepot.indexOf("["+depot.id+"]")!=-1)
{
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
}
alloptions += '<option value="' + depot.id + '">' + depot.name + '</option>';
}
}
$("#ProjectId").empty().append(options);
$("#searchProjectId").empty().append('<option value="">全部</option>').append(options);
$("#AllocationProjectId").empty().append(alloptions);
}
}
//初始化系统基础信息
function initSupplier()
{
$('#OrganId').combobox({
url: "<%=path%>/supplier/findBySelect_sup.action",
valueField:'id',
textField:'supplier'
});
}
//初始化系统基础信息
function initSystemData_person(ProjectSearch)
{
$.ajax({
type:"post",
url: "<%=path%>/person/getBasicData.action?ProjectId="+ProjectSearch,
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
personList = systemInfo.showModel.map.personList;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找系统基础信息异常,请与管理员联系!','error');
return;
}
}
});
}
//初始化页面选项卡
function initSelectInfo_person()
{
var options1 = "";
var options2 = "";
if(personList !=null)
{
for(var i = 0 ;i < personList.length;i ++)
{
var person = personList[i];
if(0 == i)
{
personID = person.id;
}
if(person.type=="采购人")
{
options1 += '<option value="' + person.id + '">' + person.name + '</option>';
}
else if(person.type=="仓管员")
{
options2 += '<option value="' + person.id + '">' + person.name + '</option>';
}
}
$("#HandsPersonId").empty().append(options1);
$("#WareHousePersonId").empty().append(options2);
}
}
$("#ProjectId").change(
function(){
var ProjectId=$("#ProjectId").val();
if(ProjectId!='')
{
initSystemData_person(ProjectId);
initSelectInfo_person();
}
}
);
//防止表单提交重复
function initForm()
{
$('#depotHeadFM').form({
onSubmit: function(){
return false;
}
});
}
//初始化表格数据
function initTableData()
{
$('#tableData').datagrid({
//title:'调拨出库列表',
//iconCls:'icon-save',
//width:700,
height:heightInfo,
rownumbers: false,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
//url:'<%=path %>/depotHead/findBy.action?pageSize=' + initPageSize,
pagination: true,
//交替出现背景
striped : true,
//loadFilter: pagerFilter,
pageSize: 5,
pageList: initPageNum,
columns:[[
{ field: 'Id',width:35,align:"center",checkbox:true},
{ title: '单据号',field: 'Number',width:100},
{ title: '出库时间 ',field: 'OperTime',width:100},
{ title: '创建时间',field: 'CreateTime',width:100},
{ title: '操作员',field: 'OperPersonName',width:100},
{ title: '备注',field: 'Remark',width:100},
{ title: '操作',field: 'op',align:"center",width:180,formatter:function(value,rec)
{
var str = '';
var rowInfo = rec.Id + 'AaBb' + rec.ProjectId+ 'AaBb' + rec.Number+ 'AaBb' + rec.OperPersonName
+ 'AaBb' + rec.OperTime+ 'AaBb' + rec.OrganId+ 'AaBb' + rec.HandsPersonId
+ 'AaBb' + rec.WareHousePersonId+ 'AaBb' + rec.SettlementWay+ 'AaBb' + rec.Remark
+ 'AaBb' + rec.ProjectName+ 'AaBb' + rec.OrganName+ 'AaBb' + rec.HandsPersonName+ 'AaBb' + rec.WareHousePersonName
+ 'AaBb' + rec.AllocationProjectId+ 'AaBb' + rec.AllocationProjectName
+ 'AaBb' + rec.ReAuditPersonName+ 'AaBb' + rec.Reason;
if(1 == value)
{
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="editDepotHead(\'' + rowInfo + '\');"/>&nbsp;<a onclick="showDepotHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">查看</a>&nbsp;&nbsp;';
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editDepotHead(\'' + rowInfo + '\');"/>&nbsp;<a onclick="editDepotHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a>&nbsp;&nbsp;';
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteDepotHead('+ rec.Id +');"/>&nbsp;<a onclick="deleteDepotHead('+ rec.Id +');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a>';
}
return str;
}
}
]],
toolbar:[
{
id:'addDepotHead',
text:'增加',
iconCls:'icon-add',
handler:function()
{
addDepotHead();
}
},
{
id:'deleteDepotHead',
text:'删除',
iconCls:'icon-remove',
handler:function()
{
batDeleteDepotHead();
}
}
],
onLoadError:function()
{
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
}
//初始化表格数据-商品列表-编辑状态
function initTableData_material()
{
$('#materialData').datagrid({
height:300,
rownumbers: false,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
url:'<%=path %>/depotItem/findBy.action?HeaderId=' + depotHeadID,
pagination: true,
//交替出现背景
striped : true,
//loadFilter: pagerFilter,
onClickRow: onClickRow,
pageSize: 5,
pageList: [5,10,15],
columns:[[
{ field: 'Id',width:35,align:"center",checkbox:true},
{ title: '名称',field: 'MaterialId',width:230,
formatter:function(value,row,index){
return row.MaterialName;
},
editor:{
type:'combobox',
options:{
valueField:'Id',
textField:'MaterialName',
method:'get',
url: "<%=path%>/material/findBySelect.action"
}
}
},
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:50},
{ title: '备注',field: 'Remark',editor:'validatebox',width:150},
{ title: '图片',field: 'Img',editor:'validatebox',width:110},
]],
toolbar:[
{
id:'append',
text:'新增',
iconCls:'icon-add',
handler:function()
{
append(); //新增
}
},
{
id:'delete',
text:'删除',
iconCls:'icon-remove',
handler:function()
{
removeit(); //删除
}
},
{
id:'reject',
text:'撤销',
iconCls:'icon-undo',
handler:function()
{
reject(); //撤销
}
}
],
onLoadError:function()
{
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
}
//初始化表格数据-商品列表-查看状态
function initTableData_material_show()
{
$('#materialDataShow').datagrid({
height:300,
rownumbers: false,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
url:'<%=path %>/depotItem/findBy.action?HeaderId=' + depotHeadID,
pagination: true,
//交替出现背景
striped : true,
//loadFilter: pagerFilter,
onClickRow: onClickRow,
pageSize: 5,
pageList: [5,10,15],
columns:[[
{ field: 'Id',width:35,align:"center",checkbox:true},
{ title: '名称',field: 'MaterialName',width:230},
{ title: '数量',field: 'OperNumber',width:50},
{ title: '备注',field: 'Remark',width:150},
{ title: '图片',field: 'Img',width:110},
]],
onLoadError:function()
{
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
}
//初始化键盘enter事件
$(document).keydown(function(event)
{
//兼容 IE和firefox 事件
var e = window.event || event;
var k = e.keyCode||e.which||e.charCode;
//兼容 IE,firefox 兼容
var obj = e.srcElement ? e.srcElement : e.target;
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
if(k == "13"&&(obj.id=="State"||obj.id=="Number"))
{
$("#saveDepotHead").click();
}
//搜索按钮添加快捷键
if(k == "13"&&(obj.id=="searchState"||obj.id=="searchNumber"))
{
$("#searchBtn").click();
}
});
//分页信息处理
function ininPager()
{
try
{
var opts = $("#tableData").datagrid('options');
var pager = $("#tableData").datagrid('getPager');
pager.pagination({
onSelectPage:function(pageNum, pageSize)
{
opts.pageNumber = pageNum;
opts.pageSize = pageSize;
pager.pagination('refresh',
{
pageNumber:pageNum,
pageSize:pageSize
});
showDepotHeadDetails(pageNum,pageSize);
}
});
}
catch (e)
{
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
}
}
//删除调拨出库信息
function deleteDepotHead(depotHeadID)
{
$.messager.confirm('删除确认','确定要删除此调拨出库信息吗?',function(r)
{
if (r)
{
$.ajax({
type:"post",
url: "<%=path %>/depotHead/delete.action",
dataType: "json",
data: ({
depotHeadID : depotHeadID,
clientIp:'<%=clientIp %>'
}),
success: function (tipInfo)
{
var msg = tipInfo.showModel.msgTip;
if(msg == '成功')
{
//加载完以后重新初始化
$("#searchBtn").click();
}
else
$.messager.alert('删除提示','删除调拨出库信息失败,请稍后再试!','error');
},
//此处添加错误处理
error:function()
{
$.messager.alert('删除提示','删除调拨出库信息异常,请稍后再试!','error');
return;
}
});
}
});
}
//批量删除调拨出库
function batDeleteDepotHead()
{
var row = $('#tableData').datagrid('getChecked');
if(row.length == 0)
{
$.messager.alert('删除提示','没有记录被选中!','info');
return;
}
if(row.length > 0)
{
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条调拨出库信息吗?',function(r)
{
if (r)
{
var ids = "";
for(var i = 0;i < row.length; i ++)
{
if(i == row.length-1)
{
ids += row[i].Id;
break;
}
//alert(row[i].id);
ids += row[i].Id + ",";
}
$.ajax({
type:"post",
url: "<%=path %>/depotHead/batchDelete.action",
dataType: "json",
async : false,
data: ({
depotHeadIDs : ids,
clientIp:'<%=clientIp %>'
}),
success: function (tipInfo)
{
var msg = tipInfo.showModel.msgTip;
if(msg == '成功')
{
//加载完以后重新初始化
$("#searchBtn").click();
$(":checkbox").attr("checked",false);
}
else
$.messager.alert('删除提示','删除调拨出库信息失败,请稍后再试!','error');
},
//此处添加错误处理
error:function()
{
$.messager.alert('删除提示','删除调拨出库信息异常,请稍后再试!','error');
return;
}
});
}
});
}
}
//增加
var url;
var depotHeadID = 0;
//保存编辑前的名称
var orgDepotHead = "";
function addDepotHead()
{
$("#clientIp").val('<%=clientIp %>');
$('#depotHeadFM').form('clear');
$('#depotHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_add.png"/>&nbsp;增加调拨出库信息');
$(".window-mask").css({ width: webW ,height: webH});
$("#Number").val("").focus();
orgDepotHead = "";
depotHeadID = 0;
initTableData_material(); //商品列表
reject(); //撤销下、刷新商品列表
url = '<%=path %>/depotHead/create.action';
}
//保存信息
$("#saveDepotHead").unbind().bind({
click:function()
{
if(!$('#depotHeadFM').form('validate'))
return;
else
{
$.ajax({
type:"post",
url: url,
dataType: "json",
async : false,
data: ({
Type:"出库",
SubType:"调拨",
ProjectId : $.trim($("#ProjectId").val()),
Number : $.trim($("#Number").val()),
OperTime: $("#OperTime").val(),
AllocationProjectId:$.trim($("#AllocationProjectId").val()),
HandsPersonId: $.trim($("#HandsPersonId").val()),
WareHousePersonId: $.trim($("#WareHousePersonId").val()),
SettlementWay: $.trim($("#SettlementWay").val()),
Remark: $.trim($("#Remark").val()),
clientIp:'<%=clientIp %>'
}),
success: function (tipInfo)
{
if(tipInfo)
{
//保存明细记录
if(depotHeadID ==0)
{
getMaxId(); //查找最大的Id
accept(depotHeadMaxId); //新增
}
else
{
accept(depotHeadID); //修改
}
$('#depotHeadDlg').dialog('close');
var opts = $("#tableData").datagrid('options');
showDepotHeadDetails(opts.pageNumber,opts.pageSize);
}
else
{
$.messager.show({
title: '错误提示',
msg: '保存调拨出库信息失败,请稍后重试!'
});
}
},
//此处添加错误处理
error:function()
{
$.messager.alert('提示','保存调拨出库信息异常,请稍后再试!','error');
return;
}
});
}
}
});
//编辑信息
function editDepotHead(depotHeadTotalInfo)
{
var depotHeadInfo = depotHeadTotalInfo.split("AaBb");
$("#clientIp").val('<%=clientIp %>');
$("#ProjectId").focus().val(depotHeadInfo[1]);
var ProjectId=depotHeadInfo[1];
if(ProjectId!='')
{
initSystemData_person(ProjectId);
initSelectInfo_person();
}
$("#Number").val(depotHeadInfo[2]);
$("#OperTime").val(depotHeadInfo[4]);
$('#AllocationProjectId').val(depotHeadInfo[14]);
$("#HandsPersonId").val(depotHeadInfo[6]);
$("#WareHousePersonId").val(depotHeadInfo[7]);
$("#SettlementWay").val(depotHeadInfo[8]);
$("#Remark").val(depotHeadInfo[9]);
//orgDepotHead = depotHeadInfo[1];
$('#depotHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png"/>&nbsp;编辑调拨出库信息');
$(".window-mask").css({ width: webW ,height: webH});
depotHeadID = depotHeadInfo[0];
initTableData_material(); //商品列表
reject(); //撤销下、刷新商品列表
url = '<%=path %>/depotHead/update.action?depotHeadID=' + depotHeadInfo[0];
}
//查看信息
function showDepotHead(depotHeadTotalInfo)
{
var depotHeadInfo = depotHeadTotalInfo.split("AaBb");
$("#ProjectIdShow").text(depotHeadInfo[10]);
$("#NumberShow").text(depotHeadInfo[2]);
$("#OperTimeShow").text(depotHeadInfo[4]);
$('#AllocationProjectIdShow').text(depotHeadInfo[15]);
$("#HandsPersonIdShow").text(depotHeadInfo[12]);
$("#WareHousePersonIdShow").text(depotHeadInfo[13]);
$("#SettlementWayShow").text(depotHeadInfo[8]);
$("#RemarkShow").text(depotHeadInfo[9]);
var audit=(depotHeadInfo[16]!="undefined"&&depotHeadInfo[17]!="undefined"&&depotHeadInfo[16]!=""&&depotHeadInfo[17]!="")?" 撤审人:"+depotHeadInfo[16]+" 撤审原因:"+depotHeadInfo[17]:"";
audit="<span style='color:red;'>"+audit+"</span>";
$('#depotHeadDlgShow').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png"/>&nbsp;查看调拨出库信息'+audit);
$(".window-mask").css({ width: webW ,height: webH});
depotHeadID = depotHeadInfo[0];
initTableData_material_show(); //商品列表-查看状态
}
//搜索处理
$("#searchBtn").unbind().bind({
click:function()
{
if($("#searchProjectId").val()=="")
{
$.messager.alert('查询提示','请选择一个仓库!','info');
}
else
{
showDepotHeadDetails(1,initPageSize);
var opts = $("#tableData").datagrid('options');
var pager = $("#tableData").datagrid('getPager');
opts.pageNumber = 1;
opts.pageSize = initPageSize;
pager.pagination('refresh',
{
pageNumber:1,
pageSize:initPageSize
});
}
}
});
function showDepotHeadDetails(pageNo,pageSize)
{
$.ajax({
type:"post",
url: "<%=path %>/depotHead/findBy.action",
dataType: "json",
data: ({
ProjectId:$.trim($("#searchProjectId").val()),
Type:"出库",
SubType:"调拨",
State:$.trim($("#searchState").val()),
Number:$.trim($("#searchNumber").val()),
BeginTime:$("#searchBeginTime").val(),
EndTime:$("#searchEndTime").val(),
pageNo:pageNo,
pageSize:pageSize
}),
success: function (data)
{
$("#tableData").datagrid('loadData',data);
},
//此处添加错误处理
error:function()
{
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
return;
}
});
}
//重置按钮
$("#searchResetBtn").unbind().bind({
click:function(){
//$("#searchProjectId").val("");
$("#searchState").val("");
$("#searchBeginTime").val("");
$("#searchEndTime").val("");
//加载完以后重新初始化
$("#searchBtn").click();
}
});
//结束编辑
var editIndex = undefined;
function endEditing() {
if (editIndex == undefined) { return true }
if ($('#materialData').datagrid('validateRow', editIndex)) {
var ed = $('#materialData').datagrid('getEditor', {index:editIndex,field:'MaterialId'});
var MaterialName = $(ed.target).combobox('getText');
$('#materialData').datagrid('getRows')[editIndex]['MaterialName'] = MaterialName;
$('#materialData').datagrid('endEdit', editIndex);
editIndex = undefined;
return true;
} else {
return false;
}
}
//单击
function onClickRow(index) {
if (editIndex != index) {
if (endEditing()) {
$('#materialData').datagrid('selectRow', index)
.datagrid('beginEdit', index);
editIndex = index;
} else {
$('#materialData').datagrid('selectRow', editIndex);
}
}
}
//新增
function append()
{
if (endEditing()) {
$('#materialData').datagrid('appendRow', {});
editIndex = $('#materialData').datagrid('getRows').length - 1;
$('#materialData').datagrid('selectRow', editIndex)
.datagrid('beginEdit', editIndex);
}
}
//删除
function removeit() {
if (editIndex == undefined) { return }
$('#materialData').datagrid('cancelEdit', editIndex)
.datagrid('deleteRow', editIndex);
editIndex = undefined;
}
//撤销
function reject() {
$('#materialData').datagrid('rejectChanges');
editIndex = undefined;
}
//判断
function CheckData() {
var row = $('#materialData').datagrid('getRows');
var totalRowNum = "";
for (var i = 0; i < row.length; i++) {
if (row[i].MaterialId == "") {
totalRowNum += (i + 1) + "、";
}
}
if (totalRowNum != "") {
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
return false;
}
return true;
}
//保存
function accept(accepId) {
append();
removeit();
if ($("#materialData").datagrid('getChanges').length) {
if (!CheckData())
return false;
var inserted = $("#materialData").datagrid('getChanges', "inserted");
var deleted = $("#materialData").datagrid('getChanges', "deleted");
var updated = $("#materialData").datagrid('getChanges', "updated");
$.ajax({
type: "post",
url: "<%=path%>/depotItem/saveDetials.action",
data: {
Inserted: JSON.stringify(inserted),
Deleted: JSON.stringify(deleted),
Updated: JSON.stringify(updated),
HeaderId:accepId,
clientIp:'<%=clientIp %>'
},
success: function (tipInfo)
{
if (tipInfo) {
$.messager.alert('提示','保存成功!','info');
}
else
$.messager.alert('提示','保存失败!','error');
},
error: function (XmlHttpRequest, textStatus, errorThrown)
{
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
}
});
}
if (endEditing()) {
$('#materialData').datagrid('acceptChanges');
}
}
//获取MaxId
function getMaxId()
{
var depotHeadMax=null;
$.ajax({
type:"post",
url: "<%=path%>/depotHead/getMaxId.action",
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
if(systemInfo)
{
depotHeadMax = systemInfo.showModel.map.depotHeadMax;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找最大的Id异常,请与管理员联系!','error');
return;
}
}
else
{
depotHeadMax=null;
}
}
});
if(depotHeadMax !=null)
{
if(depotHeadMax.length>0)
{
depotHeadMaxId=depotHeadMax[0];
}
}
}
</script>
</body>
</html>

View File

@ -157,896 +157,5 @@
</tr>
</table>
</div>
<script type="text/javascript">
return;
var depotList = null;
var depotID = null;
var supplierList = null;
var supplierID = null;
var personList = null;
var personID = null;
var ProjectSearch=null;
var kid=${sessionScope.user.id};
var userBusinessList=null;
var userdepot=null;
var depotHeadMaxId=null; //获取最大的Id
var accepId=null; //保存的主表id
//初始化界面
$(function()
{
//初始化系统基础信息
initSystemData_UB();
initSelectInfo_UB();
initSystemData_depot();
initSelectInfo_depot();
initSupplier(); //供应商
initTableData();
ininPager();
initForm();
});
//初始化系统基础信息
function initSystemData_UB()
{
$.ajax({
type:"post",
url: "<%=path%>/userBusiness/getBasicData.action",
data: ({
KeyId:kid,
Type:"UserDepot"
}),
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
if(systemInfo)
{
userBusinessList = systemInfo.showModel.map.userBusinessList;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找UserBusiness异常,请与管理员联系!','error');
return;
}
}
else
{
userBusinessList=null;
}
}
});
}
//初始化页面选项卡
function initSelectInfo_UB()
{
if(userBusinessList !=null)
{
if(userBusinessList.length>0)
{
//用户对应的部门列表 [1][2][3]...
userdepot =userBusinessList[0].value;
}
}
}
//初始化系统基础信息
function initSystemData_depot()
{
$.ajax({
type:"post",
url: "<%=path%>/depot/getBasicData.action",
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
depotList = systemInfo.showModel.map.depotList;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找系统基础信息异常,请与管理员联系!','error');
return;
}
}
});
}
//初始化页面选项卡
function initSelectInfo_depot()
{
var options = "";
if(depotList !=null)
{
options = "";
for(var i = 0 ;i < depotList.length;i ++)
{
var depot = depotList[i];
if(userdepot!=null)
{
if(userdepot.indexOf("["+depot.id+"]")!=-1)
{
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
}
}
}
$("#ProjectId").empty().append(options);
$("#searchProjectId").empty().append('<option value="">全部</option>').append(options);
}
}
//初始化系统基础信息
function initSupplier()
{
$('#OrganId').combobox({
url: "<%=path%>/supplier/findBySelect_sup.action",
valueField:'id',
textField:'supplier'
});
}
//初始化系统基础信息
function initSystemData_person(ProjectSearch)
{
$.ajax({
type:"post",
url: "<%=path%>/person/getBasicData.action?ProjectId="+ProjectSearch,
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
personList = systemInfo.showModel.map.personList;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找系统基础信息异常,请与管理员联系!','error');
return;
}
}
});
}
//初始化页面选项卡
function initSelectInfo_person()
{
var options1 = "";
var options2 = "";
if(personList !=null)
{
for(var i = 0 ;i < personList.length;i ++)
{
var person = personList[i];
if(0 == i)
{
personID = person.id;
}
if(person.type=="采购人")
{
options1 += '<option value="' + person.id + '">' + person.name + '</option>';
}
else if(person.type=="仓管员")
{
options2 += '<option value="' + person.id + '">' + person.name + '</option>';
}
}
$("#HandsPersonId").empty().append(options1);
$("#WareHousePersonId").empty().append(options2);
}
}
$("#ProjectId").change(
function(){
var ProjectId=$("#ProjectId").val();
if(ProjectId!='')
{
initSystemData_person(ProjectId);
initSelectInfo_person();
}
}
);
//防止表单提交重复
function initForm()
{
$('#depotHeadFM').form({
onSubmit: function(){
return false;
}
});
}
//初始化表格数据
function initTableData()
{
$('#tableData').datagrid({
//title:'其它入库列表',
//iconCls:'icon-save',
//width:700,
height:heightInfo,
rownumbers: false,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
//url:'<%=path %>/depotHead/findBy.action?pageSize=' + initPageSize,
pagination: true,
//交替出现背景
striped : true,
//loadFilter: pagerFilter,
pageSize: 5,
pageList: initPageNum,
columns:[[
{ field: 'Id',width:35,align:"center",checkbox:true},
{ title: '单据号',field: 'Number',width:100},
{ title: '入库时间 ',field: 'OperTime',width:100},
{ title: '创建时间',field: 'CreateTime',width:100},
{ title: '操作员',field: 'OperPersonName',width:100},
{ title: '备注',field: 'Remark',width:100},
{ title: '操作',field: 'op',align:"center",width:180,formatter:function(value,rec)
{
var str = '';
var rowInfo = rec.Id + 'AaBb' + rec.ProjectId+ 'AaBb' + rec.Number+ 'AaBb' + rec.OperPersonName
+ 'AaBb' + rec.OperTime+ 'AaBb' + rec.OrganId+ 'AaBb' + rec.HandsPersonId
+ 'AaBb' + rec.WareHousePersonId+ 'AaBb' + rec.SettlementWay+ 'AaBb' + rec.Remark
+ 'AaBb' + rec.ProjectName+ 'AaBb' + rec.OrganName+ 'AaBb' + rec.HandsPersonName+ 'AaBb' + rec.WareHousePersonName
+ 'AaBb' + rec.ReAuditPersonName+ 'AaBb' + rec.Reason;
if(1 == value)
{
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showDepotHead(\'' + rowInfo + '\');"/>&nbsp;<a onclick="showDepotHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">查看</a>&nbsp;&nbsp;';
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editDepotHead(\'' + rowInfo + '\');"/>&nbsp;<a onclick="editDepotHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a>&nbsp;&nbsp;';
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteDepotHead('+ rec.Id +');"/>&nbsp;<a onclick="deleteDepotHead('+ rec.Id +');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a>';
}
return str;
}
}
]],
toolbar:[
{
id:'addDepotHead',
text:'增加',
iconCls:'icon-add',
handler:function()
{
addDepotHead();
}
},
{
id:'deleteDepotHead',
text:'删除',
iconCls:'icon-remove',
handler:function()
{
batDeleteDepotHead();
}
}
],
onLoadError:function()
{
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
}
//初始化表格数据-商品列表-编辑状态
function initTableData_material()
{
$('#materialData').datagrid({
height:300,
rownumbers: false,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
url:'<%=path %>/depotItem/findBy.action?HeaderId=' + depotHeadID,
pagination: true,
//交替出现背景
striped : true,
//loadFilter: pagerFilter,
onClickRow: onClickRow,
pageSize: 50,
pageList: [50,100,150],
columns:[[
{ field: 'Id',width:35,align:"center",checkbox:true},
{ title: '名称',field: 'MaterialId',width:230,
formatter:function(value,row,index){
return row.MaterialName;
},
editor:{
type:'combobox',
options:{
valueField:'Id',
textField:'MaterialName',
method:'get',
url: "<%=path%>/material/findBySelect.action"
}
}
},
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:50},
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:50},
{ title: '备注',field: 'Remark',editor:'validatebox',width:150},
{ title: '图片',field: 'Img',editor:'validatebox',width:110},
]],
toolbar:[
{
id:'append',
text:'新增',
iconCls:'icon-add',
handler:function()
{
append(); //新增
}
},
{
id:'delete',
text:'删除',
iconCls:'icon-remove',
handler:function()
{
removeit(); //删除
}
},
{
id:'reject',
text:'撤销',
iconCls:'icon-undo',
handler:function()
{
reject(); //撤销
}
}
],
onLoadError:function()
{
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
}
//初始化表格数据-商品列表-查看状态
function initTableData_material_show()
{
$('#materialDataShow').datagrid({
height:300,
rownumbers: false,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
url:'<%=path %>/depotItem/findBy.action?HeaderId=' + depotHeadID,
pagination: true,
//交替出现背景
striped : true,
//loadFilter: pagerFilter,
onClickRow: onClickRow,
pageSize: 50,
pageList: [50,100,150],
columns:[[
{ field: 'Id',width:35,align:"center",checkbox:true},
{ title: '名称',field: 'MaterialName',width:230},
{ title: '数量',field: 'OperNumber',width:50},
{ title: '单价',field: 'UnitPrice',width:50},
{ title: '备注',field: 'Remark',width:150},
{ title: '图片',field: 'Img',width:110},
]],
onLoadError:function()
{
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
}
//初始化键盘enter事件
$(document).keydown(function(event)
{
//兼容 IE和firefox 事件
var e = window.event || event;
var k = e.keyCode||e.which||e.charCode;
//兼容 IE,firefox 兼容
var obj = e.srcElement ? e.srcElement : e.target;
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
if(k == "13"&&(obj.id=="State"||obj.id=="Number"))
{
$("#saveDepotHead").click();
}
//搜索按钮添加快捷键
if(k == "13"&&(obj.id=="searchState"||obj.id=="searchNumber"))
{
$("#searchBtn").click();
}
});
//分页信息处理
function ininPager()
{
try
{
var opts = $("#tableData").datagrid('options');
var pager = $("#tableData").datagrid('getPager');
pager.pagination({
onSelectPage:function(pageNum, pageSize)
{
opts.pageNumber = pageNum;
opts.pageSize = pageSize;
pager.pagination('refresh',
{
pageNumber:pageNum,
pageSize:pageSize
});
showDepotHeadDetails(pageNum,pageSize);
}
});
}
catch (e)
{
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
}
}
//删除其它入库信息
function deleteDepotHead(depotHeadID)
{
$.messager.confirm('删除确认','确定要删除此其它入库信息吗?',function(r)
{
if (r)
{
$.ajax({
type:"post",
url: "<%=path %>/depotHead/delete.action",
dataType: "json",
data: ({
depotHeadID : depotHeadID,
clientIp:'<%=clientIp %>'
}),
success: function (tipInfo)
{
var msg = tipInfo.showModel.msgTip;
if(msg == '成功')
{
//加载完以后重新初始化
$("#searchBtn").click();
}
else
$.messager.alert('删除提示','删除其它入库信息失败,请稍后再试!','error');
},
//此处添加错误处理
error:function()
{
$.messager.alert('删除提示','删除其它入库信息异常,请稍后再试!','error');
return;
}
});
}
});
}
//批量删除其它入库
function batDeleteDepotHead()
{
var row = $('#tableData').datagrid('getChecked');
if(row.length == 0)
{
$.messager.alert('删除提示','没有记录被选中!','info');
return;
}
if(row.length > 0)
{
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条其它入库信息吗?',function(r)
{
if (r)
{
var ids = "";
for(var i = 0;i < row.length; i ++)
{
if(i == row.length-1)
{
ids += row[i].Id;
break;
}
//alert(row[i].id);
ids += row[i].Id + ",";
}
$.ajax({
type:"post",
url: "<%=path %>/depotHead/batchDelete.action",
dataType: "json",
async : false,
data: ({
depotHeadIDs : ids,
clientIp:'<%=clientIp %>'
}),
success: function (tipInfo)
{
var msg = tipInfo.showModel.msgTip;
if(msg == '成功')
{
//加载完以后重新初始化
$("#searchBtn").click();
$(":checkbox").attr("checked",false);
}
else
$.messager.alert('删除提示','删除其它入库信息失败,请稍后再试!','error');
},
//此处添加错误处理
error:function()
{
$.messager.alert('删除提示','删除其它入库信息异常,请稍后再试!','error');
return;
}
});
}
});
}
}
//增加
var url;
var depotHeadID = 0;
//保存编辑前的名称
var orgDepotHead = "";
function addDepotHead()
{
$("#clientIp").val('<%=clientIp %>');
$('#depotHeadFM').form('clear');
$('#depotHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_add.png"/>&nbsp;增加其它入库信息');
$(".window-mask").css({ width: webW ,height: webH});
$("#Number").val("").focus();
orgDepotHead = "";
depotHeadID = 0;
initTableData_material(); //商品列表
reject(); //撤销下、刷新商品列表
url = '<%=path %>/depotHead/create.action';
}
//保存信息
$("#saveDepotHead").unbind().bind({
click:function()
{
if(!$('#depotHeadFM').form('validate'))
return;
else
{
$.ajax({
type:"post",
url: url,
dataType: "json",
async : false,
data: ({
Type:"入库",
SubType:"其它",
ProjectId : $.trim($("#ProjectId").val()),
Number : $.trim($("#Number").val()),
OperTime: $("#OperTime").val(),
OrganId: $('#OrganId').combobox('getValue'),
HandsPersonId: $.trim($("#HandsPersonId").val()),
WareHousePersonId: $.trim($("#WareHousePersonId").val()),
SettlementWay: $.trim($("#SettlementWay").val()),
Remark: $.trim($("#Remark").val()),
clientIp:'<%=clientIp %>'
}),
success: function (tipInfo)
{
if(tipInfo)
{
//保存明细记录
if(depotHeadID ==0)
{
getMaxId(); //查找最大的Id
accept(depotHeadMaxId); //新增
}
else
{
accept(depotHeadID); //修改
}
$('#depotHeadDlg').dialog('close');
var opts = $("#tableData").datagrid('options');
showDepotHeadDetails(opts.pageNumber,opts.pageSize);
}
else
{
$.messager.show({
title: '错误提示',
msg: '保存其它入库信息失败,请稍后重试!'
});
}
},
//此处添加错误处理
error:function()
{
$.messager.alert('提示','保存其它入库信息异常,请稍后再试!','error');
return;
}
});
}
}
});
//编辑信息
function editDepotHead(depotHeadTotalInfo)
{
var depotHeadInfo = depotHeadTotalInfo.split("AaBb");
$("#clientIp").val('<%=clientIp %>');
$("#ProjectId").focus().val(depotHeadInfo[1]);
var ProjectId=depotHeadInfo[1];
if(ProjectId!='')
{
initSystemData_person(ProjectId);
initSelectInfo_person();
}
$("#Number").val(depotHeadInfo[2]);
$("#OperTime").val(depotHeadInfo[4]);
$('#OrganId').combobox('setValue', depotHeadInfo[5]);
$("#HandsPersonId").val(depotHeadInfo[6]);
$("#WareHousePersonId").val(depotHeadInfo[7]);
$("#SettlementWay").val(depotHeadInfo[8]);
$("#Remark").val(depotHeadInfo[9]);
//orgDepotHead = depotHeadInfo[1];
$('#depotHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png"/>&nbsp;编辑其它入库信息');
$(".window-mask").css({ width: webW ,height: webH});
depotHeadID = depotHeadInfo[0];
initTableData_material(); //商品列表
reject(); //撤销下、刷新商品列表
url = '<%=path %>/depotHead/update.action?depotHeadID=' + depotHeadInfo[0];
}
//查看信息
function showDepotHead(depotHeadTotalInfo)
{
var depotHeadInfo = depotHeadTotalInfo.split("AaBb");
$("#ProjectIdShow").text(depotHeadInfo[10]);
$("#NumberShow").text(depotHeadInfo[2]);
$("#OperTimeShow").text(depotHeadInfo[4]);
$('#OrganIdShow').text(depotHeadInfo[11]);
$("#HandsPersonIdShow").text(depotHeadInfo[12]);
$("#WareHousePersonIdShow").text(depotHeadInfo[13]);
$("#SettlementWayShow").text(depotHeadInfo[8]);
$("#RemarkShow").text(depotHeadInfo[9]);
var audit=(depotHeadInfo[14]!="undefined"&&depotHeadInfo[15]!="undefined"&&depotHeadInfo[14]!=""&&depotHeadInfo[15]!="")?" 撤审人:"+depotHeadInfo[14]+" 撤审原因:"+depotHeadInfo[15]:"";
audit="<span style='color:red;'>"+audit+"</span>";
$('#depotHeadDlgShow').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png"/>&nbsp;查看其它入库信息'+audit);
$(".window-mask").css({ width: webW ,height: webH});
depotHeadID = depotHeadInfo[0];
initTableData_material_show(); //商品列表-查看状态
}
//搜索处理
$("#searchBtn").unbind().bind({
click:function()
{
if($("#searchProjectId").val()=="")
{
$.messager.alert('查询提示','请选择一个仓库!','info');
}
else
{
showDepotHeadDetails(1,initPageSize);
var opts = $("#tableData").datagrid('options');
var pager = $("#tableData").datagrid('getPager');
opts.pageNumber = 1;
opts.pageSize = initPageSize;
pager.pagination('refresh',
{
pageNumber:1,
pageSize:initPageSize
});
}
}
});
function showDepotHeadDetails(pageNo,pageSize)
{
$.ajax({
type:"post",
url: "<%=path %>/depotHead/findBy.action",
dataType: "json",
data: ({
ProjectId:$.trim($("#searchProjectId").val()),
Type:"入库",
SubType:"其它",
State:$.trim($("#searchState").val()),
Number:$.trim($("#searchNumber").val()),
BeginTime:$("#searchBeginTime").val(),
EndTime:$("#searchEndTime").val(),
pageNo:pageNo,
pageSize:pageSize
}),
success: function (data)
{
$("#tableData").datagrid('loadData',data);
},
//此处添加错误处理
error:function()
{
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
return;
}
});
}
//重置按钮
$("#searchResetBtn").unbind().bind({
click:function(){
//$("#searchProjectId").val("");
$("#searchState").val("");
$("#searchBeginTime").val("");
$("#searchEndTime").val("");
//加载完以后重新初始化
$("#searchBtn").click();
}
});
//结束编辑
var editIndex = undefined;
function endEditing() {
if (editIndex == undefined) { return true }
if ($('#materialData').datagrid('validateRow', editIndex)) {
var ed = $('#materialData').datagrid('getEditor', {index:editIndex,field:'MaterialId'});
var MaterialName = $(ed.target).combobox('getText');
$('#materialData').datagrid('getRows')[editIndex]['MaterialName'] = MaterialName;
$('#materialData').datagrid('endEdit', editIndex);
editIndex = undefined;
return true;
} else {
return false;
}
}
//单击
function onClickRow(index) {
if (editIndex != index) {
if (endEditing()) {
$('#materialData').datagrid('selectRow', index)
.datagrid('beginEdit', index);
editIndex = index;
} else {
$('#materialData').datagrid('selectRow', editIndex);
}
}
}
//新增
function append()
{
if (endEditing()) {
$('#materialData').datagrid('appendRow', {});
editIndex = $('#materialData').datagrid('getRows').length - 1;
$('#materialData').datagrid('selectRow', editIndex)
.datagrid('beginEdit', editIndex);
}
}
//删除
function removeit() {
if (editIndex == undefined) { return }
$('#materialData').datagrid('cancelEdit', editIndex)
.datagrid('deleteRow', editIndex);
editIndex = undefined;
}
//撤销
function reject() {
$('#materialData').datagrid('rejectChanges');
editIndex = undefined;
}
//判断
function CheckData() {
var row = $('#materialData').datagrid('getRows');
var totalRowNum = "";
for (var i = 0; i < row.length; i++) {
if (row[i].MaterialId == "") {
totalRowNum += (i + 1) + "、";
}
}
if (totalRowNum != "") {
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
return false;
}
return true;
}
//保存
function accept(accepId) {
append();
removeit();
if ($("#materialData").datagrid('getChanges').length) {
if (!CheckData())
return false;
var inserted = $("#materialData").datagrid('getChanges', "inserted");
var deleted = $("#materialData").datagrid('getChanges', "deleted");
var updated = $("#materialData").datagrid('getChanges', "updated");
$.ajax({
type: "post",
url: "<%=path%>/depotItem/saveDetials.action",
data: {
Inserted: JSON.stringify(inserted),
Deleted: JSON.stringify(deleted),
Updated: JSON.stringify(updated),
HeaderId:accepId,
clientIp:'<%=clientIp %>'
},
success: function (tipInfo)
{
if (tipInfo) {
$.messager.alert('提示','保存成功!','info');
}
else
$.messager.alert('提示','保存失败!','error');
},
error: function (XmlHttpRequest, textStatus, errorThrown)
{
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
}
});
}
if (endEditing()) {
$('#materialData').datagrid('acceptChanges');
}
}
//获取MaxId
function getMaxId()
{
var depotHeadMax=null;
$.ajax({
type:"post",
url: "<%=path%>/depotHead/getMaxId.action",
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
if(systemInfo)
{
depotHeadMax = systemInfo.showModel.map.depotHeadMax;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找最大的Id异常,请与管理员联系!','error');
return;
}
}
else
{
depotHeadMax=null;
}
}
});
if(depotHeadMax !=null)
{
if(depotHeadMax.length>0)
{
depotHeadMaxId=depotHeadMax[0];
}
}
}
</script>
</body>
</html>

View File

@ -156,894 +156,6 @@
</td>
</tr>
</table>
</div>
<script type="text/javascript">
return;
var depotList = null;
var depotID = null;
var supplierList = null;
var supplierID = null;
var personList = null;
var personID = null;
var ProjectSearch=null;
var kid=${sessionScope.user.id};
var userBusinessList=null;
var userdepot=null;
var depotHeadMaxId=null; //获取最大的Id
var accepId=null; //保存的主表id
//初始化界面
$(function()
{
//初始化系统基础信息
initSystemData_UB();
initSelectInfo_UB();
initSystemData_depot();
initSelectInfo_depot();
initSupplier(); //供应商
initTableData();
ininPager();
initForm();
});
//初始化系统基础信息
function initSystemData_UB()
{
$.ajax({
type:"post",
url: "<%=path%>/userBusiness/getBasicData.action",
data: ({
KeyId:kid,
Type:"UserDepot"
}),
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
if(systemInfo)
{
userBusinessList = systemInfo.showModel.map.userBusinessList;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找UserBusiness异常,请与管理员联系!','error');
return;
}
}
else
{
userBusinessList=null;
}
}
});
}
//初始化页面选项卡
function initSelectInfo_UB()
{
if(userBusinessList !=null)
{
if(userBusinessList.length>0)
{
//用户对应的部门列表 [1][2][3]...
userdepot =userBusinessList[0].value;
}
}
}
//初始化系统基础信息
function initSystemData_depot()
{
$.ajax({
type:"post",
url: "<%=path%>/depot/getBasicData.action",
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
depotList = systemInfo.showModel.map.depotList;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找系统基础信息异常,请与管理员联系!','error');
return;
}
}
});
}
//初始化页面选项卡
function initSelectInfo_depot()
{
var options = "";
if(depotList !=null)
{
options = "";
for(var i = 0 ;i < depotList.length;i ++)
{
var depot = depotList[i];
if(userdepot!=null)
{
if(userdepot.indexOf("["+depot.id+"]")!=-1)
{
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
}
}
}
$("#ProjectId").empty().append(options);
$("#searchProjectId").empty().append('<option value="">全部</option>').append(options);
}
}
//初始化系统基础信息
function initSupplier()
{
$('#OrganId').combobox({
url: "<%=path%>/supplier/findBySelect_cus.action",
valueField:'id',
textField:'supplier'
});
}
//初始化系统基础信息
function initSystemData_person(ProjectSearch)
{
$.ajax({
type:"post",
url: "<%=path%>/person/getBasicData.action?ProjectId="+ProjectSearch,
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
personList = systemInfo.showModel.map.personList;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找系统基础信息异常,请与管理员联系!','error');
return;
}
}
});
}
//初始化页面选项卡
function initSelectInfo_person()
{
var options1 = "";
var options2 = "";
if(personList !=null)
{
for(var i = 0 ;i < personList.length;i ++)
{
var person = personList[i];
if(0 == i)
{
personID = person.id;
}
if(person.type=="采购人")
{
options1 += '<option value="' + person.id + '">' + person.name + '</option>';
}
else if(person.type=="仓管员")
{
options2 += '<option value="' + person.id + '">' + person.name + '</option>';
}
}
$("#HandsPersonId").empty().append(options1);
$("#WareHousePersonId").empty().append(options2);
}
}
$("#ProjectId").change(
function(){
var ProjectId=$("#ProjectId").val();
if(ProjectId!='')
{
initSystemData_person(ProjectId);
initSelectInfo_person();
}
}
);
//防止表单提交重复
function initForm()
{
$('#depotHeadFM').form({
onSubmit: function(){
return false;
}
});
}
//初始化表格数据
function initTableData()
{
$('#tableData').datagrid({
//title:'其它出库列表',
//iconCls:'icon-save',
//width:700,
height:heightInfo,
rownumbers: false,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
//url:'<%=path %>/depotHead/findBy.action?pageSize=' + initPageSize,
pagination: true,
//交替出现背景
striped : true,
//loadFilter: pagerFilter,
pageSize: 5,
pageList: initPageNum,
columns:[[
{ field: 'Id',width:35,align:"center",checkbox:true},
{ title: '单据号',field: 'Number',width:100},
{ title: '出库时间 ',field: 'OperTime',width:100},
{ title: '创建时间',field: 'CreateTime',width:100},
{ title: '操作员',field: 'OperPersonName',width:100},
{ title: '备注',field: 'Remark',width:100},
{ title: '操作',field: 'op',align:"center",width:180,formatter:function(value,rec)
{
var str = '';
var rowInfo = rec.Id + 'AaBb' + rec.ProjectId+ 'AaBb' + rec.Number+ 'AaBb' + rec.OperPersonName
+ 'AaBb' + rec.OperTime+ 'AaBb' + rec.OrganId+ 'AaBb' + rec.HandsPersonId
+ 'AaBb' + rec.WareHousePersonId+ 'AaBb' + rec.SettlementWay+ 'AaBb' + rec.Remark
+ 'AaBb' + rec.ProjectName+ 'AaBb' + rec.OrganName+ 'AaBb' + rec.HandsPersonName+ 'AaBb' + rec.WareHousePersonName;
if(1 == value)
{
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="editDepotHead(\'' + rowInfo + '\');"/>&nbsp;<a onclick="showDepotHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">查看</a>&nbsp;&nbsp;';
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editDepotHead(\'' + rowInfo + '\');"/>&nbsp;<a onclick="editDepotHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a>&nbsp;&nbsp;';
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteDepotHead('+ rec.Id +');"/>&nbsp;<a onclick="deleteDepotHead('+ rec.Id +');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a>';
}
return str;
}
}
]],
toolbar:[
{
id:'addDepotHead',
text:'增加',
iconCls:'icon-add',
handler:function()
{
addDepotHead();
}
},
{
id:'deleteDepotHead',
text:'删除',
iconCls:'icon-remove',
handler:function()
{
batDeleteDepotHead();
}
}
],
onLoadError:function()
{
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
}
//初始化表格数据-商品列表-编辑状态
function initTableData_material()
{
$('#materialData').datagrid({
height:300,
rownumbers: false,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
url:'<%=path %>/depotItem/findBy.action?HeaderId=' + depotHeadID,
pagination: true,
//交替出现背景
striped : true,
//loadFilter: pagerFilter,
onClickRow: onClickRow,
pageSize: 5,
pageList: [5,10,15],
columns:[[
{ field: 'Id',width:35,align:"center",checkbox:true},
{ title: '名称',field: 'MaterialId',width:230,
formatter:function(value,row,index){
return row.MaterialName;
},
editor:{
type:'combobox',
options:{
valueField:'Id',
textField:'MaterialName',
method:'get',
url: "<%=path%>/material/findBySelect.action"
}
}
},
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:50},
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:50},
{ title: '备注',field: 'Remark',editor:'validatebox',width:150},
{ title: '图片',field: 'Img',editor:'validatebox',width:110},
]],
toolbar:[
{
id:'append',
text:'新增',
iconCls:'icon-add',
handler:function()
{
append(); //新增
}
},
{
id:'delete',
text:'删除',
iconCls:'icon-remove',
handler:function()
{
removeit(); //删除
}
},
{
id:'reject',
text:'撤销',
iconCls:'icon-undo',
handler:function()
{
reject(); //撤销
}
}
],
onLoadError:function()
{
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
}
//初始化表格数据-商品列表-查看状态
function initTableData_material_show()
{
$('#materialDataShow').datagrid({
height:300,
rownumbers: false,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
url:'<%=path %>/depotItem/findBy.action?HeaderId=' + depotHeadID,
pagination: true,
//交替出现背景
striped : true,
//loadFilter: pagerFilter,
onClickRow: onClickRow,
pageSize: 5,
pageList: [5,10,15],
columns:[[
{ field: 'Id',width:35,align:"center",checkbox:true},
{ title: '名称',field: 'MaterialName',width:230},
{ title: '数量',field: 'OperNumber',width:50},
{ title: '单价',field: 'UnitPrice',width:50},
{ title: '备注',field: 'Remark',width:150},
{ title: '图片',field: 'Img',width:110},
]],
onLoadError:function()
{
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
}
//初始化键盘enter事件
$(document).keydown(function(event)
{
//兼容 IE和firefox 事件
var e = window.event || event;
var k = e.keyCode||e.which||e.charCode;
//兼容 IE,firefox 兼容
var obj = e.srcElement ? e.srcElement : e.target;
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
if(k == "13"&&(obj.id=="State"||obj.id=="Number"))
{
$("#saveDepotHead").click();
}
//搜索按钮添加快捷键
if(k == "13"&&(obj.id=="searchState"||obj.id=="searchNumber"))
{
$("#searchBtn").click();
}
});
//分页信息处理
function ininPager()
{
try
{
var opts = $("#tableData").datagrid('options');
var pager = $("#tableData").datagrid('getPager');
pager.pagination({
onSelectPage:function(pageNum, pageSize)
{
opts.pageNumber = pageNum;
opts.pageSize = pageSize;
pager.pagination('refresh',
{
pageNumber:pageNum,
pageSize:pageSize
});
showDepotHeadDetails(pageNum,pageSize);
}
});
}
catch (e)
{
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
}
}
//删除其它出库信息
function deleteDepotHead(depotHeadID)
{
$.messager.confirm('删除确认','确定要删除此其它出库信息吗?',function(r)
{
if (r)
{
$.ajax({
type:"post",
url: "<%=path %>/depotHead/delete.action",
dataType: "json",
data: ({
depotHeadID : depotHeadID,
clientIp:'<%=clientIp %>'
}),
success: function (tipInfo)
{
var msg = tipInfo.showModel.msgTip;
if(msg == '成功')
{
//加载完以后重新初始化
$("#searchBtn").click();
}
else
$.messager.alert('删除提示','删除其它出库信息失败,请稍后再试!','error');
},
//此处添加错误处理
error:function()
{
$.messager.alert('删除提示','删除其它出库信息异常,请稍后再试!','error');
return;
}
});
}
});
}
//批量删除其它出库
function batDeleteDepotHead()
{
var row = $('#tableData').datagrid('getChecked');
if(row.length == 0)
{
$.messager.alert('删除提示','没有记录被选中!','info');
return;
}
if(row.length > 0)
{
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条其它出库信息吗?',function(r)
{
if (r)
{
var ids = "";
for(var i = 0;i < row.length; i ++)
{
if(i == row.length-1)
{
ids += row[i].Id;
break;
}
//alert(row[i].id);
ids += row[i].Id + ",";
}
$.ajax({
type:"post",
url: "<%=path %>/depotHead/batchDelete.action",
dataType: "json",
async : false,
data: ({
depotHeadIDs : ids,
clientIp:'<%=clientIp %>'
}),
success: function (tipInfo)
{
var msg = tipInfo.showModel.msgTip;
if(msg == '成功')
{
//加载完以后重新初始化
$("#searchBtn").click();
$(":checkbox").attr("checked",false);
}
else
$.messager.alert('删除提示','删除其它出库信息失败,请稍后再试!','error');
},
//此处添加错误处理
error:function()
{
$.messager.alert('删除提示','删除其它出库信息异常,请稍后再试!','error');
return;
}
});
}
});
}
}
//增加
var url;
var depotHeadID = 0;
//保存编辑前的名称
var orgDepotHead = "";
function addDepotHead()
{
$("#clientIp").val('<%=clientIp %>');
$('#depotHeadFM').form('clear');
$('#depotHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_add.png"/>&nbsp;增加其它出库信息');
$(".window-mask").css({ width: webW ,height: webH});
$("#Number").val("").focus();
orgDepotHead = "";
depotHeadID = 0;
initTableData_material(); //商品列表
reject(); //撤销下、刷新商品列表
url = '<%=path %>/depotHead/create.action';
}
//保存信息
$("#saveDepotHead").unbind().bind({
click:function()
{
if(!$('#depotHeadFM').form('validate'))
return;
else
{
$.ajax({
type:"post",
url: url,
dataType: "json",
async : false,
data: ({
Type:"出库",
SubType:"其它",
ProjectId : $.trim($("#ProjectId").val()),
Number : $.trim($("#Number").val()),
OperTime: $("#OperTime").val(),
OrganId: $('#OrganId').combobox('getValue'),
HandsPersonId: $.trim($("#HandsPersonId").val()),
WareHousePersonId: $.trim($("#WareHousePersonId").val()),
SettlementWay: $.trim($("#SettlementWay").val()),
Remark: $.trim($("#Remark").val()),
clientIp:'<%=clientIp %>'
}),
success: function (tipInfo)
{
if(tipInfo)
{
//保存明细记录
if(depotHeadID ==0)
{
getMaxId(); //查找最大的Id
accept(depotHeadMaxId); //新增
}
else
{
accept(depotHeadID); //修改
}
$('#depotHeadDlg').dialog('close');
var opts = $("#tableData").datagrid('options');
showDepotHeadDetails(opts.pageNumber,opts.pageSize);
}
else
{
$.messager.show({
title: '错误提示',
msg: '保存其它出库信息失败,请稍后重试!'
});
}
},
//此处添加错误处理
error:function()
{
$.messager.alert('提示','保存其它出库信息异常,请稍后再试!','error');
return;
}
});
}
}
});
//编辑信息
function editDepotHead(depotHeadTotalInfo)
{
var depotHeadInfo = depotHeadTotalInfo.split("AaBb");
$("#clientIp").val('<%=clientIp %>');
$("#ProjectId").focus().val(depotHeadInfo[1]);
var ProjectId=depotHeadInfo[1];
if(ProjectId!='')
{
initSystemData_person(ProjectId);
initSelectInfo_person();
}
$("#Number").val(depotHeadInfo[2]);
$("#OperTime").val(depotHeadInfo[4]);
$('#OrganId').combobox('setValue', depotHeadInfo[5]);
$("#HandsPersonId").val(depotHeadInfo[6]);
$("#WareHousePersonId").val(depotHeadInfo[7]);
$("#SettlementWay").val(depotHeadInfo[8]);
$("#Remark").val(depotHeadInfo[9]);
//orgDepotHead = depotHeadInfo[1];
$('#depotHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png"/>&nbsp;编辑其它出库信息');
$(".window-mask").css({ width: webW ,height: webH});
depotHeadID = depotHeadInfo[0];
initTableData_material(); //商品列表
reject(); //撤销下、刷新商品列表
url = '<%=path %>/depotHead/update.action?depotHeadID=' + depotHeadInfo[0];
}
//查看信息
function showDepotHead(depotHeadTotalInfo)
{
var depotHeadInfo = depotHeadTotalInfo.split("AaBb");
$("#ProjectIdShow").text(depotHeadInfo[10]);
$("#NumberShow").text(depotHeadInfo[2]);
$("#OperTimeShow").text(depotHeadInfo[4]);
$('#OrganIdShow').text(depotHeadInfo[11]);
$("#HandsPersonIdShow").text(depotHeadInfo[12]);
$("#WareHousePersonIdShow").text(depotHeadInfo[13]);
$("#SettlementWayShow").text(depotHeadInfo[8]);
$("#RemarkShow").text(depotHeadInfo[9]);
$('#depotHeadDlgShow').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png"/>&nbsp;查看其它出库信息');
$(".window-mask").css({ width: webW ,height: webH});
depotHeadID = depotHeadInfo[0];
initTableData_material_show(); //商品列表-查看状态
}
//搜索处理
$("#searchBtn").unbind().bind({
click:function()
{
if($("#searchProjectId").val()=="")
{
$.messager.alert('查询提示','请选择一个仓库!','info');
}
else
{
showDepotHeadDetails(1,initPageSize);
var opts = $("#tableData").datagrid('options');
var pager = $("#tableData").datagrid('getPager');
opts.pageNumber = 1;
opts.pageSize = initPageSize;
pager.pagination('refresh',
{
pageNumber:1,
pageSize:initPageSize
});
}
}
});
function showDepotHeadDetails(pageNo,pageSize)
{
$.ajax({
type:"post",
url: "<%=path %>/depotHead/findBy.action",
dataType: "json",
data: ({
ProjectId:$.trim($("#searchProjectId").val()),
Type:"出库",
SubType:"其它",
State:$.trim($("#searchState").val()),
Number:$.trim($("#searchNumber").val()),
BeginTime:$("#searchBeginTime").val(),
EndTime:$("#searchEndTime").val(),
pageNo:pageNo,
pageSize:pageSize
}),
success: function (data)
{
$("#tableData").datagrid('loadData',data);
},
//此处添加错误处理
error:function()
{
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
return;
}
});
}
//重置按钮
$("#searchResetBtn").unbind().bind({
click:function(){
//$("#searchProjectId").val("");
$("#searchState").val("");
$("#searchBeginTime").val("");
$("#searchEndTime").val("");
//加载完以后重新初始化
$("#searchBtn").click();
}
});
//结束编辑
var editIndex = undefined;
function endEditing() {
if (editIndex == undefined) { return true }
if ($('#materialData').datagrid('validateRow', editIndex)) {
var ed = $('#materialData').datagrid('getEditor', {index:editIndex,field:'MaterialId'});
var MaterialName = $(ed.target).combobox('getText');
$('#materialData').datagrid('getRows')[editIndex]['MaterialName'] = MaterialName;
$('#materialData').datagrid('endEdit', editIndex);
editIndex = undefined;
return true;
} else {
return false;
}
}
//单击
function onClickRow(index) {
if (editIndex != index) {
if (endEditing()) {
$('#materialData').datagrid('selectRow', index)
.datagrid('beginEdit', index);
editIndex = index;
} else {
$('#materialData').datagrid('selectRow', editIndex);
}
}
}
//新增
function append()
{
if (endEditing()) {
$('#materialData').datagrid('appendRow', {});
editIndex = $('#materialData').datagrid('getRows').length - 1;
$('#materialData').datagrid('selectRow', editIndex)
.datagrid('beginEdit', editIndex);
}
}
//删除
function removeit() {
if (editIndex == undefined) { return }
$('#materialData').datagrid('cancelEdit', editIndex)
.datagrid('deleteRow', editIndex);
editIndex = undefined;
}
//撤销
function reject() {
$('#materialData').datagrid('rejectChanges');
editIndex = undefined;
}
//判断
function CheckData() {
var row = $('#materialData').datagrid('getRows');
var totalRowNum = "";
for (var i = 0; i < row.length; i++) {
if (row[i].MaterialId == "") {
totalRowNum += (i + 1) + "、";
}
}
if (totalRowNum != "") {
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
return false;
}
return true;
}
//保存
function accept(accepId) {
append();
removeit();
if ($("#materialData").datagrid('getChanges').length) {
if (!CheckData())
return false;
var inserted = $("#materialData").datagrid('getChanges', "inserted");
var deleted = $("#materialData").datagrid('getChanges', "deleted");
var updated = $("#materialData").datagrid('getChanges', "updated");
$.ajax({
type: "post",
url: "<%=path%>/depotItem/saveDetials.action",
data: {
Inserted: JSON.stringify(inserted),
Deleted: JSON.stringify(deleted),
Updated: JSON.stringify(updated),
HeaderId:accepId,
clientIp:'<%=clientIp %>'
},
success: function (tipInfo)
{
if (tipInfo) {
$.messager.alert('提示','保存成功!','info');
}
else
$.messager.alert('提示','保存失败!','error');
},
error: function (XmlHttpRequest, textStatus, errorThrown)
{
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
}
});
}
if (endEditing()) {
$('#materialData').datagrid('acceptChanges');
}
}
//获取MaxId
function getMaxId()
{
var depotHeadMax=null;
$.ajax({
type:"post",
url: "<%=path%>/depotHead/getMaxId.action",
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
if(systemInfo)
{
depotHeadMax = systemInfo.showModel.map.depotHeadMax;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找最大的Id异常,请与管理员联系!','error');
return;
}
}
else
{
depotHeadMax=null;
}
}
});
if(depotHeadMax !=null)
{
if(depotHeadMax.length>0)
{
depotHeadMaxId=depotHeadMax[0];
}
}
}
</script>
</div>
</body>
</html>

View File

@ -164,897 +164,6 @@
</td>
</tr>
</table>
</div>
<script type="text/javascript">
return;
var depotList = null;
var depotID = null;
var supplierList = null;
var supplierID = null;
var personList = null;
var personID = null;
var ProjectSearch=null;
var kid=${sessionScope.user.id};
var userBusinessList=null;
var userdepot=null;
var depotHeadMaxId=null; //获取最大的Id
var accepId=null; //保存的主表id
//初始化界面
$(function()
{
//初始化系统基础信息
initSystemData_UB();
initSelectInfo_UB();
initSystemData_depot();
initSelectInfo_depot();
initSupplier(); //供应商
initTableData();
ininPager();
initForm();
});
//初始化系统基础信息
function initSystemData_UB()
{
$.ajax({
type:"post",
url: "<%=path%>/userBusiness/getBasicData.action",
data: ({
KeyId:kid,
Type:"UserDepot"
}),
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
if(systemInfo)
{
userBusinessList = systemInfo.showModel.map.userBusinessList;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找UserBusiness异常,请与管理员联系!','error');
return;
}
}
else
{
userBusinessList=null;
}
}
});
}
//初始化页面选项卡
function initSelectInfo_UB()
{
if(userBusinessList !=null)
{
if(userBusinessList.length>0)
{
//用户对应的部门列表 [1][2][3]...
userdepot =userBusinessList[0].value;
}
}
}
//初始化系统基础信息
function initSystemData_depot()
{
$.ajax({
type:"post",
url: "<%=path%>/depot/getBasicData.action",
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
depotList = systemInfo.showModel.map.depotList;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找系统基础信息异常,请与管理员联系!','error');
return;
}
}
});
}
//初始化页面选项卡
function initSelectInfo_depot()
{
var options = "";
if(depotList !=null)
{
options = "";
for(var i = 0 ;i < depotList.length;i ++)
{
var depot = depotList[i];
if(userdepot!=null)
{
if(userdepot.indexOf("["+depot.id+"]")!=-1)
{
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
}
}
}
$("#ProjectId").empty().append(options);
$("#searchProjectId").empty().append('<option value="">全部</option>').append(options);
}
}
//初始化系统基础信息
function initSupplier()
{
$('#OrganId').combobox({
url: "<%=path%>/supplier/findBySelect_sup.action",
valueField:'id',
textField:'supplier'
});
}
//初始化系统基础信息
function initSystemData_person(ProjectSearch)
{
$.ajax({
type:"post",
url: "<%=path%>/person/getBasicData.action?ProjectId="+ProjectSearch,
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
personList = systemInfo.showModel.map.personList;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找系统基础信息异常,请与管理员联系!','error');
return;
}
}
});
}
//初始化页面选项卡
function initSelectInfo_person()
{
var options1 = "";
var options2 = "";
if(personList !=null)
{
for(var i = 0 ;i < personList.length;i ++)
{
var person = personList[i];
if(0 == i)
{
personID = person.id;
}
if(person.type=="采购人")
{
options1 += '<option value="' + person.id + '">' + person.name + '</option>';
}
else if(person.type=="仓管员")
{
options2 += '<option value="' + person.id + '">' + person.name + '</option>';
}
}
$("#HandsPersonId").empty().append(options1);
$("#WareHousePersonId").empty().append(options2);
}
}
$("#ProjectId").change(
function(){
var ProjectId=$("#ProjectId").val();
if(ProjectId!='')
{
initSystemData_person(ProjectId);
initSelectInfo_person();
}
}
);
//防止表单提交重复
function initForm()
{
$('#depotHeadFM').form({
onSubmit: function(){
return false;
}
});
}
//初始化表格数据
function initTableData()
{
$('#tableData').datagrid({
//title:'采购退货列表',
//iconCls:'icon-save',
//width:700,
height:heightInfo,
rownumbers: false,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
//url:'<%=path %>/depotHead/findBy.action?pageSize=' + initPageSize,
pagination: true,
//交替出现背景
striped : true,
//loadFilter: pagerFilter,
pageSize: 5,
pageList: initPageNum,
columns:[[
{ field: 'Id',width:35,align:"center",checkbox:true},
{ title: '单据号',field: 'Number',width:100},
{ title: '入库时间 ',field: 'OperTime',width:100},
{ title: '创建时间',field: 'CreateTime',width:100},
{ title: '操作员',field: 'OperPersonName',width:100},
{ title: '备注',field: 'Remark',width:100},
{ title: '操作',field: 'op',align:"center",width:180,formatter:function(value,rec)
{
var str = '';
var rowInfo = rec.Id + 'AaBb' + rec.ProjectId+ 'AaBb' + rec.Number+ 'AaBb' + rec.OperPersonName
+ 'AaBb' + rec.OperTime+ 'AaBb' + rec.OrganId+ 'AaBb' + rec.HandsPersonId
+ 'AaBb' + rec.WareHousePersonId+ 'AaBb' + rec.SettlementWay+ 'AaBb' + rec.Remark
+ 'AaBb' + rec.ProjectName+ 'AaBb' + rec.OrganName+ 'AaBb' + rec.HandsPersonName+ 'AaBb' + rec.WareHousePersonName
+ 'AaBb' + rec.ReAuditPersonName+ 'AaBb' + rec.Reason;
if(1 == value)
{
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showDepotHead(\'' + rowInfo + '\');"/>&nbsp;<a onclick="showDepotHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">查看</a>&nbsp;&nbsp;';
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editDepotHead(\'' + rowInfo + '\');"/>&nbsp;<a onclick="editDepotHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a>&nbsp;&nbsp;';
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteDepotHead('+ rec.Id +');"/>&nbsp;<a onclick="deleteDepotHead('+ rec.Id +');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a>';
}
return str;
}
}
]],
toolbar:[
{
id:'addDepotHead',
text:'增加',
iconCls:'icon-add',
handler:function()
{
addDepotHead();
}
},
{
id:'deleteDepotHead',
text:'删除',
iconCls:'icon-remove',
handler:function()
{
batDeleteDepotHead();
}
}
],
onLoadError:function()
{
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
}
//初始化表格数据-商品列表-编辑状态
function initTableData_material()
{
$('#materialData').datagrid({
height:300,
rownumbers: false,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
url:'<%=path %>/depotItem/findBy.action?HeaderId=' + depotHeadID,
pagination: true,
//交替出现背景
striped : true,
//loadFilter: pagerFilter,
onClickRow: onClickRow,
pageSize: 50,
pageList: [50,100,150],
columns:[[
{ field: 'Id',width:35,align:"center",checkbox:true},
{ title: '名称',field: 'MaterialId',width:230,
formatter:function(value,row,index){
return row.MaterialName;
},
editor:{
type:'combobox',
options:{
valueField:'Id',
textField:'MaterialName',
method:'get',
url: "<%=path%>/material/findBySelect.action"
}
}
},
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:50},
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:50},
{ title: '备注',field: 'Remark',editor:'validatebox',width:150},
{ title: '图片',field: 'Img',editor:'validatebox',width:110},
]],
toolbar:[
{
id:'append',
text:'新增',
iconCls:'icon-add',
handler:function()
{
append(); //新增
}
},
{
id:'delete',
text:'删除',
iconCls:'icon-remove',
handler:function()
{
removeit(); //删除
}
},
{
id:'reject',
text:'撤销',
iconCls:'icon-undo',
handler:function()
{
reject(); //撤销
}
}
],
onLoadError:function()
{
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
}
//初始化表格数据-商品列表-查看状态
function initTableData_material_show()
{
$('#materialDataShow').datagrid({
height:300,
rownumbers: false,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
url:'<%=path %>/depotItem/findBy.action?HeaderId=' + depotHeadID,
pagination: true,
//交替出现背景
striped : true,
//loadFilter: pagerFilter,
onClickRow: onClickRow,
pageSize: 50,
pageList: [50,100,150],
columns:[[
{ field: 'Id',width:35,align:"center",checkbox:true},
{ title: '名称',field: 'MaterialName',width:230},
{ title: '数量',field: 'OperNumber',width:50},
{ title: '单价',field: 'UnitPrice',width:50},
{ title: '备注',field: 'Remark',width:150},
{ title: '图片',field: 'Img',width:110},
]],
onLoadError:function()
{
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
}
//初始化键盘enter事件
$(document).keydown(function(event)
{
//兼容 IE和firefox 事件
var e = window.event || event;
var k = e.keyCode||e.which||e.charCode;
//兼容 IE,firefox 兼容
var obj = e.srcElement ? e.srcElement : e.target;
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
if(k == "13"&&(obj.id=="State"||obj.id=="Number"))
{
$("#saveDepotHead").click();
}
//搜索按钮添加快捷键
if(k == "13"&&(obj.id=="searchState"||obj.id=="searchNumber"))
{
$("#searchBtn").click();
}
});
//分页信息处理
function ininPager()
{
try
{
var opts = $("#tableData").datagrid('options');
var pager = $("#tableData").datagrid('getPager');
pager.pagination({
onSelectPage:function(pageNum, pageSize)
{
opts.pageNumber = pageNum;
opts.pageSize = pageSize;
pager.pagination('refresh',
{
pageNumber:pageNum,
pageSize:pageSize
});
showDepotHeadDetails(pageNum,pageSize);
}
});
}
catch (e)
{
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
}
}
//删除采购退货信息
function deleteDepotHead(depotHeadID)
{
$.messager.confirm('删除确认','确定要删除此采购退货信息吗?',function(r)
{
if (r)
{
$.ajax({
type:"post",
url: "<%=path %>/depotHead/delete.action",
dataType: "json",
data: ({
depotHeadID : depotHeadID,
clientIp:'<%=clientIp %>'
}),
success: function (tipInfo)
{
var msg = tipInfo.showModel.msgTip;
if(msg == '成功')
{
//加载完以后重新初始化
$("#searchBtn").click();
}
else
$.messager.alert('删除提示','删除采购退货信息失败,请稍后再试!','error');
},
//此处添加错误处理
error:function()
{
$.messager.alert('删除提示','删除采购退货信息异常,请稍后再试!','error');
return;
}
});
}
});
}
//批量删除采购退货
function batDeleteDepotHead()
{
var row = $('#tableData').datagrid('getChecked');
if(row.length == 0)
{
$.messager.alert('删除提示','没有记录被选中!','info');
return;
}
if(row.length > 0)
{
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条采购退货信息吗?',function(r)
{
if (r)
{
var ids = "";
for(var i = 0;i < row.length; i ++)
{
if(i == row.length-1)
{
ids += row[i].Id;
break;
}
//alert(row[i].id);
ids += row[i].Id + ",";
}
$.ajax({
type:"post",
url: "<%=path %>/depotHead/batchDelete.action",
dataType: "json",
async : false,
data: ({
depotHeadIDs : ids,
clientIp:'<%=clientIp %>'
}),
success: function (tipInfo)
{
var msg = tipInfo.showModel.msgTip;
if(msg == '成功')
{
//加载完以后重新初始化
$("#searchBtn").click();
$(":checkbox").attr("checked",false);
}
else
$.messager.alert('删除提示','删除采购退货信息失败,请稍后再试!','error');
},
//此处添加错误处理
error:function()
{
$.messager.alert('删除提示','删除采购退货信息异常,请稍后再试!','error');
return;
}
});
}
});
}
}
//增加
var url;
var depotHeadID = 0;
//保存编辑前的名称
var orgDepotHead = "";
function addDepotHead()
{
$("#clientIp").val('<%=clientIp %>');
$('#depotHeadFM').form('clear');
$('#depotHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_add.png"/>&nbsp;增加采购退货信息');
$(".window-mask").css({ width: webW ,height: webH});
$("#Number").val("").focus();
orgDepotHead = "";
depotHeadID = 0;
initTableData_material(); //商品列表
reject(); //撤销下、刷新商品列表
url = '<%=path %>/depotHead/create.action';
}
//保存信息
$("#saveDepotHead").unbind().bind({
click:function()
{
if(!$('#depotHeadFM').form('validate'))
return;
else
{
$.ajax({
type:"post",
url: url,
dataType: "json",
async : false,
data: ({
Type:"出库",
SubType:"采购退货",
ProjectId : $.trim($("#ProjectId").val()),
Number : $.trim($("#Number").val()),
OperTime: $("#OperTime").val(),
OrganId: $('#OrganId').combobox('getValue'),
HandsPersonId: $.trim($("#HandsPersonId").val()),
WareHousePersonId: $.trim($("#WareHousePersonId").val()),
SettlementWay: $.trim($("#SettlementWay").val()),
Remark: $.trim($("#Remark").val()),
clientIp:'<%=clientIp %>'
}),
success: function (tipInfo)
{
if(tipInfo)
{
//保存明细记录
if(depotHeadID ==0)
{
getMaxId(); //查找最大的Id
accept(depotHeadMaxId); //新增
}
else
{
accept(depotHeadID); //修改
}
$('#depotHeadDlg').dialog('close');
var opts = $("#tableData").datagrid('options');
showDepotHeadDetails(opts.pageNumber,opts.pageSize);
}
else
{
$.messager.show({
title: '错误提示',
msg: '保存采购退货信息失败,请稍后重试!'
});
}
},
//此处添加错误处理
error:function()
{
$.messager.alert('提示','保存采购退货信息异常,请稍后再试!','error');
return;
}
});
}
}
});
//编辑信息
function editDepotHead(depotHeadTotalInfo)
{
var depotHeadInfo = depotHeadTotalInfo.split("AaBb");
$("#clientIp").val('<%=clientIp %>');
$("#ProjectId").focus().val(depotHeadInfo[1]);
var ProjectId=depotHeadInfo[1];
if(ProjectId!='')
{
initSystemData_person(ProjectId);
initSelectInfo_person();
}
$("#Number").val(depotHeadInfo[2]);
$("#OperTime").val(depotHeadInfo[4]);
$('#OrganId').combobox('setValue', depotHeadInfo[5]);
$("#HandsPersonId").val(depotHeadInfo[6]);
$("#WareHousePersonId").val(depotHeadInfo[7]);
$("#SettlementWay").val(depotHeadInfo[8]);
$("#Remark").val(depotHeadInfo[9]);
//orgDepotHead = depotHeadInfo[1];
$('#depotHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png"/>&nbsp;编辑采购退货信息');
$(".window-mask").css({ width: webW ,height: webH});
depotHeadID = depotHeadInfo[0];
initTableData_material(); //商品列表
reject(); //撤销下、刷新商品列表
url = '<%=path %>/depotHead/update.action?depotHeadID=' + depotHeadInfo[0];
}
//查看信息
function showDepotHead(depotHeadTotalInfo)
{
var depotHeadInfo = depotHeadTotalInfo.split("AaBb");
$("#ProjectIdShow").text(depotHeadInfo[10]);
$("#NumberShow").text(depotHeadInfo[2]);
$("#OperTimeShow").text(depotHeadInfo[4]);
$('#OrganIdShow').text(depotHeadInfo[11]);
$("#HandsPersonIdShow").text(depotHeadInfo[12]);
$("#WareHousePersonIdShow").text(depotHeadInfo[13]);
$("#SettlementWayShow").text(depotHeadInfo[8]);
$("#RemarkShow").text(depotHeadInfo[9]);
var audit=(depotHeadInfo[14]!="undefined"&&depotHeadInfo[15]!="undefined"&&depotHeadInfo[14]!=""&&depotHeadInfo[15]!="")?" 撤审人:"+depotHeadInfo[14]+" 撤审原因:"+depotHeadInfo[15]:"";
audit="<span style='color:red;'>"+audit+"</span>";
$('#depotHeadDlgShow').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png"/>&nbsp;查看采购退货信息'+audit);
$(".window-mask").css({ width: webW ,height: webH});
depotHeadID = depotHeadInfo[0];
initTableData_material_show(); //商品列表-查看状态
}
//搜索处理
$("#searchBtn").unbind().bind({
click:function()
{
if($("#searchProjectId").val()=="")
{
$.messager.alert('查询提示','请选择一个仓库!','info');
}
else
{
showDepotHeadDetails(1,initPageSize);
var opts = $("#tableData").datagrid('options');
var pager = $("#tableData").datagrid('getPager');
opts.pageNumber = 1;
opts.pageSize = initPageSize;
pager.pagination('refresh',
{
pageNumber:1,
pageSize:initPageSize
});
}
}
});
function showDepotHeadDetails(pageNo,pageSize)
{
$.ajax({
type:"post",
url: "<%=path %>/depotHead/findBy.action",
dataType: "json",
data: ({
ProjectId:$.trim($("#searchProjectId").val()),
Type:"出库",
SubType:"采购退货",
State:$.trim($("#searchState").val()),
Number:$.trim($("#searchNumber").val()),
BeginTime:$("#searchBeginTime").val(),
EndTime:$("#searchEndTime").val(),
pageNo:pageNo,
pageSize:pageSize
}),
success: function (data)
{
$("#tableData").datagrid('loadData',data);
},
//此处添加错误处理
error:function()
{
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
return;
}
});
}
//重置按钮
$("#searchResetBtn").unbind().bind({
click:function(){
//$("#searchProjectId").val("");
$("#searchState").val("");
$("#searchBeginTime").val("");
$("#searchEndTime").val("");
//加载完以后重新初始化
$("#searchBtn").click();
}
});
//结束编辑
var editIndex = undefined;
function endEditing() {
if (editIndex == undefined) { return true }
if ($('#materialData').datagrid('validateRow', editIndex)) {
var ed = $('#materialData').datagrid('getEditor', {index:editIndex,field:'MaterialId'});
var MaterialName = $(ed.target).combobox('getText');
$('#materialData').datagrid('getRows')[editIndex]['MaterialName'] = MaterialName;
$('#materialData').datagrid('endEdit', editIndex);
editIndex = undefined;
return true;
} else {
return false;
}
}
//单击
function onClickRow(index) {
if (editIndex != index) {
if (endEditing()) {
$('#materialData').datagrid('selectRow', index)
.datagrid('beginEdit', index);
editIndex = index;
} else {
$('#materialData').datagrid('selectRow', editIndex);
}
}
}
//新增
function append()
{
if (endEditing()) {
$('#materialData').datagrid('appendRow', {});
editIndex = $('#materialData').datagrid('getRows').length - 1;
$('#materialData').datagrid('selectRow', editIndex)
.datagrid('beginEdit', editIndex);
}
}
//删除
function removeit() {
if (editIndex == undefined) { return }
$('#materialData').datagrid('cancelEdit', editIndex)
.datagrid('deleteRow', editIndex);
editIndex = undefined;
}
//撤销
function reject() {
$('#materialData').datagrid('rejectChanges');
editIndex = undefined;
}
//判断
function CheckData() {
var row = $('#materialData').datagrid('getRows');
var totalRowNum = "";
for (var i = 0; i < row.length; i++) {
if (row[i].MaterialId == "") {
totalRowNum += (i + 1) + "、";
}
}
if (totalRowNum != "") {
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
return false;
}
return true;
}
//保存
function accept(accepId) {
append();
removeit();
if ($("#materialData").datagrid('getChanges').length) {
if (!CheckData())
return false;
var inserted = $("#materialData").datagrid('getChanges', "inserted");
var deleted = $("#materialData").datagrid('getChanges', "deleted");
var updated = $("#materialData").datagrid('getChanges', "updated");
$.ajax({
type: "post",
url: "<%=path%>/depotItem/saveDetials.action",
data: {
Inserted: JSON.stringify(inserted),
Deleted: JSON.stringify(deleted),
Updated: JSON.stringify(updated),
HeaderId:accepId,
clientIp:'<%=clientIp %>'
},
success: function (tipInfo)
{
if (tipInfo) {
$.messager.alert('提示','保存成功!','info');
}
else
$.messager.alert('提示','保存失败!','error');
},
error: function (XmlHttpRequest, textStatus, errorThrown)
{
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
}
});
}
if (endEditing()) {
$('#materialData').datagrid('acceptChanges');
}
}
//获取MaxId
function getMaxId()
{
var depotHeadMax=null;
$.ajax({
type:"post",
url: "<%=path%>/depotHead/getMaxId.action",
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
if(systemInfo)
{
depotHeadMax = systemInfo.showModel.map.depotHeadMax;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找最大的Id异常,请与管理员联系!','error');
return;
}
}
else
{
depotHeadMax=null;
}
}
});
if(depotHeadMax !=null)
{
if(depotHeadMax.length>0)
{
depotHeadMaxId=depotHeadMax[0];
}
}
}
</script>
</div>
</body>
</html>

View File

@ -164,893 +164,5 @@
</tr>
</table>
</div>
<script type="text/javascript">
return;
var depotList = null;
var depotID = null;
var supplierList = null;
var supplierID = null;
var personList = null;
var personID = null;
var ProjectSearch=null;
var kid=${sessionScope.user.id};
var userBusinessList=null;
var userdepot=null;
var depotHeadMaxId=null; //获取最大的Id
var accepId=null; //保存的主表id
//初始化界面
$(function()
{
//初始化系统基础信息
initSystemData_UB();
initSelectInfo_UB();
initSystemData_depot();
initSelectInfo_depot();
initSupplier(); //供应商
initTableData();
ininPager();
initForm();
});
//初始化系统基础信息
function initSystemData_UB()
{
$.ajax({
type:"post",
url: "<%=path%>/userBusiness/getBasicData.action",
data: ({
KeyId:kid,
Type:"UserDepot"
}),
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
if(systemInfo)
{
userBusinessList = systemInfo.showModel.map.userBusinessList;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找UserBusiness异常,请与管理员联系!','error');
return;
}
}
else
{
userBusinessList=null;
}
}
});
}
//初始化页面选项卡
function initSelectInfo_UB()
{
if(userBusinessList !=null)
{
if(userBusinessList.length>0)
{
//用户对应的部门列表 [1][2][3]...
userdepot =userBusinessList[0].value;
}
}
}
//初始化系统基础信息
function initSystemData_depot()
{
$.ajax({
type:"post",
url: "<%=path%>/depot/getBasicData.action",
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
depotList = systemInfo.showModel.map.depotList;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找系统基础信息异常,请与管理员联系!','error');
return;
}
}
});
}
//初始化页面选项卡
function initSelectInfo_depot()
{
var options = "";
if(depotList !=null)
{
options = "";
for(var i = 0 ;i < depotList.length;i ++)
{
var depot = depotList[i];
if(userdepot!=null)
{
if(userdepot.indexOf("["+depot.id+"]")!=-1)
{
options += '<option value="' + depot.id + '">' + depot.name + '</option>';
}
}
}
$("#ProjectId").empty().append(options);
$("#searchProjectId").empty().append('<option value="">全部</option>').append(options);
}
}
//初始化系统基础信息
function initSupplier()
{
$('#OrganId').combobox({
url: "<%=path%>/supplier/findBySelect_cus.action",
valueField:'id',
textField:'supplier'
});
}
//初始化系统基础信息
function initSystemData_person(ProjectSearch)
{
$.ajax({
type:"post",
url: "<%=path%>/person/getBasicData.action?ProjectId="+ProjectSearch,
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
personList = systemInfo.showModel.map.personList;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找系统基础信息异常,请与管理员联系!','error');
return;
}
}
});
}
//初始化页面选项卡
function initSelectInfo_person()
{
var options1 = "";
var options2 = "";
if(personList !=null)
{
for(var i = 0 ;i < personList.length;i ++)
{
var person = personList[i];
if(0 == i)
{
personID = person.id;
}
if(person.type=="采购人")
{
options1 += '<option value="' + person.id + '">' + person.name + '</option>';
}
else if(person.type=="仓管员")
{
options2 += '<option value="' + person.id + '">' + person.name + '</option>';
}
}
$("#HandsPersonId").empty().append(options1);
$("#WareHousePersonId").empty().append(options2);
}
}
$("#ProjectId").change(
function(){
var ProjectId=$("#ProjectId").val();
if(ProjectId!='')
{
initSystemData_person(ProjectId);
initSelectInfo_person();
}
}
);
//防止表单提交重复
function initForm()
{
$('#depotHeadFM').form({
onSubmit: function(){
return false;
}
});
}
//初始化表格数据
function initTableData()
{
$('#tableData').datagrid({
//title:'销售出库列表',
//iconCls:'icon-save',
//width:700,
height:heightInfo,
rownumbers: false,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
//url:'<%=path %>/depotHead/findBy.action?pageSize=' + initPageSize,
pagination: true,
//交替出现背景
striped : true,
//loadFilter: pagerFilter,
pageSize: 5,
pageList: initPageNum,
columns:[[
{ field: 'Id',width:35,align:"center",checkbox:true},
{ title: '单据号',field: 'Number',width:100},
{ title: '出库时间 ',field: 'OperTime',width:100},
{ title: '创建时间',field: 'CreateTime',width:100},
{ title: '操作员',field: 'OperPersonName',width:100},
{ title: '备注',field: 'Remark',width:100},
{ title: '操作',field: 'op',align:"center",width:180,formatter:function(value,rec)
{
var str = '';
var rowInfo = rec.Id + 'AaBb' + rec.ProjectId+ 'AaBb' + rec.Number+ 'AaBb' + rec.OperPersonName
+ 'AaBb' + rec.OperTime+ 'AaBb' + rec.OrganId+ 'AaBb' + rec.HandsPersonId
+ 'AaBb' + rec.WareHousePersonId+ 'AaBb' + rec.SettlementWay+ 'AaBb' + rec.Remark
+ 'AaBb' + rec.ProjectName+ 'AaBb' + rec.OrganName+ 'AaBb' + rec.HandsPersonName+ 'AaBb' + rec.WareHousePersonName;
if(1 == value)
{
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="editDepotHead(\'' + rowInfo + '\');"/>&nbsp;<a onclick="showDepotHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">查看</a>&nbsp;&nbsp;';
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editDepotHead(\'' + rowInfo + '\');"/>&nbsp;<a onclick="editDepotHead(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a>&nbsp;&nbsp;';
str += '<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteDepotHead('+ rec.Id +');"/>&nbsp;<a onclick="deleteDepotHead('+ rec.Id +');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a>';
}
return str;
}
}
]],
toolbar:[
{
id:'addDepotHead',
text:'增加',
iconCls:'icon-add',
handler:function()
{
addDepotHead();
}
},
{
id:'deleteDepotHead',
text:'删除',
iconCls:'icon-remove',
handler:function()
{
batDeleteDepotHead();
}
}
],
onLoadError:function()
{
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
}
//初始化表格数据-商品列表-编辑状态
function initTableData_material()
{
$('#materialData').datagrid({
height:300,
rownumbers: false,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
url:'<%=path %>/depotItem/findBy.action?HeaderId=' + depotHeadID,
pagination: true,
//交替出现背景
striped : true,
//loadFilter: pagerFilter,
onClickRow: onClickRow,
pageSize: 5,
pageList: [5,10,15],
columns:[[
{ field: 'Id',width:35,align:"center",checkbox:true},
{ title: '名称',field: 'MaterialId',width:230,
formatter:function(value,row,index){
return row.MaterialName;
},
editor:{
type:'combobox',
options:{
valueField:'Id',
textField:'MaterialName',
method:'get',
url: "<%=path%>/material/findBySelect.action"
}
}
},
{ title: '数量',field: 'OperNumber',editor:'validatebox',width:50},
{ title: '单价',field: 'UnitPrice',editor:'validatebox',width:50},
{ title: '备注',field: 'Remark',editor:'validatebox',width:150},
{ title: '图片',field: 'Img',editor:'validatebox',width:110},
]],
toolbar:[
{
id:'append',
text:'新增',
iconCls:'icon-add',
handler:function()
{
append(); //新增
}
},
{
id:'delete',
text:'删除',
iconCls:'icon-remove',
handler:function()
{
removeit(); //删除
}
},
{
id:'reject',
text:'撤销',
iconCls:'icon-undo',
handler:function()
{
reject(); //撤销
}
}
],
onLoadError:function()
{
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
}
//初始化表格数据-商品列表-查看状态
function initTableData_material_show()
{
$('#materialDataShow').datagrid({
height:300,
rownumbers: false,
//动画效果
animate:false,
//选中单行
singleSelect : true,
collapsible:false,
selectOnCheck:false,
//fitColumns:true,
//单击行是否选中
//checkOnSelect : false,
url:'<%=path %>/depotItem/findBy.action?HeaderId=' + depotHeadID,
pagination: true,
//交替出现背景
striped : true,
//loadFilter: pagerFilter,
onClickRow: onClickRow,
pageSize: 5,
pageList: [5,10,15],
columns:[[
{ field: 'Id',width:35,align:"center",checkbox:true},
{ title: '名称',field: 'MaterialName',width:230},
{ title: '数量',field: 'OperNumber',width:50},
{ title: '单价',field: 'UnitPrice',width:50},
{ title: '备注',field: 'Remark',width:150},
{ title: '图片',field: 'Img',width:110},
]],
onLoadError:function()
{
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
return;
}
});
}
//初始化键盘enter事件
$(document).keydown(function(event)
{
//兼容 IE和firefox 事件
var e = window.event || event;
var k = e.keyCode||e.which||e.charCode;
//兼容 IE,firefox 兼容
var obj = e.srcElement ? e.srcElement : e.target;
//绑定键盘事件为 id是指定的输入框才可以触发键盘事件 13键盘事件 ---遗留问题 enter键效验 对话框会关闭问题
if(k == "13"&&(obj.id=="State"||obj.id=="Number"))
{
$("#saveDepotHead").click();
}
//搜索按钮添加快捷键
if(k == "13"&&(obj.id=="searchState"||obj.id=="searchNumber"))
{
$("#searchBtn").click();
}
});
//分页信息处理
function ininPager()
{
try
{
var opts = $("#tableData").datagrid('options');
var pager = $("#tableData").datagrid('getPager');
pager.pagination({
onSelectPage:function(pageNum, pageSize)
{
opts.pageNumber = pageNum;
opts.pageSize = pageSize;
pager.pagination('refresh',
{
pageNumber:pageNum,
pageSize:pageSize
});
showDepotHeadDetails(pageNum,pageSize);
}
});
}
catch (e)
{
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
}
}
//删除销售出库信息
function deleteDepotHead(depotHeadID)
{
$.messager.confirm('删除确认','确定要删除此销售出库信息吗?',function(r)
{
if (r)
{
$.ajax({
type:"post",
url: "<%=path %>/depotHead/delete.action",
dataType: "json",
data: ({
depotHeadID : depotHeadID,
clientIp:'<%=clientIp %>'
}),
success: function (tipInfo)
{
var msg = tipInfo.showModel.msgTip;
if(msg == '成功')
{
//加载完以后重新初始化
$("#searchBtn").click();
}
else
$.messager.alert('删除提示','删除销售出库信息失败,请稍后再试!','error');
},
//此处添加错误处理
error:function()
{
$.messager.alert('删除提示','删除销售出库信息异常,请稍后再试!','error');
return;
}
});
}
});
}
//批量删除销售出库
function batDeleteDepotHead()
{
var row = $('#tableData').datagrid('getChecked');
if(row.length == 0)
{
$.messager.alert('删除提示','没有记录被选中!','info');
return;
}
if(row.length > 0)
{
$.messager.confirm('删除确认','确定要删除选中的' + row.length + '条销售出库信息吗?',function(r)
{
if (r)
{
var ids = "";
for(var i = 0;i < row.length; i ++)
{
if(i == row.length-1)
{
ids += row[i].Id;
break;
}
//alert(row[i].id);
ids += row[i].Id + ",";
}
$.ajax({
type:"post",
url: "<%=path %>/depotHead/batchDelete.action",
dataType: "json",
async : false,
data: ({
depotHeadIDs : ids,
clientIp:'<%=clientIp %>'
}),
success: function (tipInfo)
{
var msg = tipInfo.showModel.msgTip;
if(msg == '成功')
{
//加载完以后重新初始化
$("#searchBtn").click();
$(":checkbox").attr("checked",false);
}
else
$.messager.alert('删除提示','删除销售出库信息失败,请稍后再试!','error');
},
//此处添加错误处理
error:function()
{
$.messager.alert('删除提示','删除销售出库信息异常,请稍后再试!','error');
return;
}
});
}
});
}
}
//增加
var url;
var depotHeadID = 0;
//保存编辑前的名称
var orgDepotHead = "";
function addDepotHead()
{
$("#clientIp").val('<%=clientIp %>');
$('#depotHeadFM').form('clear');
$('#depotHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/edit_add.png"/>&nbsp;增加销售出库信息');
$(".window-mask").css({ width: webW ,height: webH});
$("#Number").val("").focus();
orgDepotHead = "";
depotHeadID = 0;
initTableData_material(); //商品列表
reject(); //撤销下、刷新商品列表
url = '<%=path %>/depotHead/create.action';
}
//保存信息
$("#saveDepotHead").unbind().bind({
click:function()
{
if(!$('#depotHeadFM').form('validate'))
return;
else
{
$.ajax({
type:"post",
url: url,
dataType: "json",
async : false,
data: ({
Type:"出库",
SubType:"销售",
ProjectId : $.trim($("#ProjectId").val()),
Number : $.trim($("#Number").val()),
OperTime: $("#OperTime").val(),
OrganId: $('#OrganId').combobox('getValue'),
HandsPersonId: $.trim($("#HandsPersonId").val()),
WareHousePersonId: $.trim($("#WareHousePersonId").val()),
SettlementWay: $.trim($("#SettlementWay").val()),
Remark: $.trim($("#Remark").val()),
clientIp:'<%=clientIp %>'
}),
success: function (tipInfo)
{
if(tipInfo)
{
//保存明细记录
if(depotHeadID ==0)
{
getMaxId(); //查找最大的Id
accept(depotHeadMaxId); //新增
}
else
{
accept(depotHeadID); //修改
}
$('#depotHeadDlg').dialog('close');
var opts = $("#tableData").datagrid('options');
showDepotHeadDetails(opts.pageNumber,opts.pageSize);
}
else
{
$.messager.show({
title: '错误提示',
msg: '保存销售出库信息失败,请稍后重试!'
});
}
},
//此处添加错误处理
error:function()
{
$.messager.alert('提示','保存销售出库信息异常,请稍后再试!','error');
return;
}
});
}
}
});
//编辑信息
function editDepotHead(depotHeadTotalInfo)
{
var depotHeadInfo = depotHeadTotalInfo.split("AaBb");
$("#clientIp").val('<%=clientIp %>');
$("#ProjectId").focus().val(depotHeadInfo[1]);
var ProjectId=depotHeadInfo[1];
if(ProjectId!='')
{
initSystemData_person(ProjectId);
initSelectInfo_person();
}
$("#Number").val(depotHeadInfo[2]);
$("#OperTime").val(depotHeadInfo[4]);
$('#OrganId').combobox('setValue', depotHeadInfo[5]);
$("#HandsPersonId").val(depotHeadInfo[6]);
$("#WareHousePersonId").val(depotHeadInfo[7]);
$("#SettlementWay").val(depotHeadInfo[8]);
$("#Remark").val(depotHeadInfo[9]);
//orgDepotHead = depotHeadInfo[1];
$('#depotHeadDlg').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/pencil.png"/>&nbsp;编辑销售出库信息');
$(".window-mask").css({ width: webW ,height: webH});
depotHeadID = depotHeadInfo[0];
initTableData_material(); //商品列表
reject(); //撤销下、刷新商品列表
url = '<%=path %>/depotHead/update.action?depotHeadID=' + depotHeadInfo[0];
}
//查看信息
function showDepotHead(depotHeadTotalInfo)
{
var depotHeadInfo = depotHeadTotalInfo.split("AaBb");
$("#ProjectIdShow").text(depotHeadInfo[10]);
$("#NumberShow").text(depotHeadInfo[2]);
$("#OperTimeShow").text(depotHeadInfo[4]);
$('#OrganIdShow').text(depotHeadInfo[11]);
$("#HandsPersonIdShow").text(depotHeadInfo[12]);
$("#WareHousePersonIdShow").text(depotHeadInfo[13]);
$("#SettlementWayShow").text(depotHeadInfo[8]);
$("#RemarkShow").text(depotHeadInfo[9]);
$('#depotHeadDlgShow').dialog('open').dialog('setTitle','<img src="<%=path%>/js/easyui-1.3.5/themes/icons/list.png"/>&nbsp;查看销售出库信息');
$(".window-mask").css({ width: webW ,height: webH});
depotHeadID = depotHeadInfo[0];
initTableData_material_show(); //商品列表-查看状态
}
//搜索处理
$("#searchBtn").unbind().bind({
click:function()
{
if($("#searchProjectId").val()=="")
{
$.messager.alert('查询提示','请选择一个仓库!','info');
}
else
{
showDepotHeadDetails(1,initPageSize);
var opts = $("#tableData").datagrid('options');
var pager = $("#tableData").datagrid('getPager');
opts.pageNumber = 1;
opts.pageSize = initPageSize;
pager.pagination('refresh',
{
pageNumber:1,
pageSize:initPageSize
});
}
}
});
function showDepotHeadDetails(pageNo,pageSize)
{
$.ajax({
type:"post",
url: "<%=path %>/depotHead/findBy.action",
dataType: "json",
data: ({
ProjectId:$.trim($("#searchProjectId").val()),
Type:"出库",
SubType:"销售",
State:$.trim($("#searchState").val()),
Number:$.trim($("#searchNumber").val()),
BeginTime:$("#searchBeginTime").val(),
EndTime:$("#searchEndTime").val(),
pageNo:pageNo,
pageSize:pageSize
}),
success: function (data)
{
$("#tableData").datagrid('loadData',data);
},
//此处添加错误处理
error:function()
{
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
return;
}
});
}
//重置按钮
$("#searchResetBtn").unbind().bind({
click:function(){
//$("#searchProjectId").val("");
$("#searchState").val("");
$("#searchBeginTime").val("");
$("#searchEndTime").val("");
//加载完以后重新初始化
$("#searchBtn").click();
}
});
//结束编辑
var editIndex = undefined;
function endEditing() {
if (editIndex == undefined) { return true }
if ($('#materialData').datagrid('validateRow', editIndex)) {
var ed = $('#materialData').datagrid('getEditor', {index:editIndex,field:'MaterialId'});
var MaterialName = $(ed.target).combobox('getText');
$('#materialData').datagrid('getRows')[editIndex]['MaterialName'] = MaterialName;
$('#materialData').datagrid('endEdit', editIndex);
editIndex = undefined;
return true;
} else {
return false;
}
}
//单击
function onClickRow(index) {
if (editIndex != index) {
if (endEditing()) {
$('#materialData').datagrid('selectRow', index)
.datagrid('beginEdit', index);
editIndex = index;
} else {
$('#materialData').datagrid('selectRow', editIndex);
}
}
}
//新增
function append()
{
if (endEditing()) {
$('#materialData').datagrid('appendRow', {});
editIndex = $('#materialData').datagrid('getRows').length - 1;
$('#materialData').datagrid('selectRow', editIndex)
.datagrid('beginEdit', editIndex);
}
}
//删除
function removeit() {
if (editIndex == undefined) { return }
$('#materialData').datagrid('cancelEdit', editIndex)
.datagrid('deleteRow', editIndex);
editIndex = undefined;
}
//撤销
function reject() {
$('#materialData').datagrid('rejectChanges');
editIndex = undefined;
}
//判断
function CheckData() {
var row = $('#materialData').datagrid('getRows');
var totalRowNum = "";
for (var i = 0; i < row.length; i++) {
if (row[i].MaterialId == "") {
totalRowNum += (i + 1) + "、";
}
}
if (totalRowNum != "") {
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
return false;
}
return true;
}
//保存
function accept(accepId) {
append();
removeit();
if ($("#materialData").datagrid('getChanges').length) {
if (!CheckData())
return false;
var inserted = $("#materialData").datagrid('getChanges', "inserted");
var deleted = $("#materialData").datagrid('getChanges', "deleted");
var updated = $("#materialData").datagrid('getChanges', "updated");
$.ajax({
type: "post",
url: "<%=path%>/depotItem/saveDetials.action",
data: {
Inserted: JSON.stringify(inserted),
Deleted: JSON.stringify(deleted),
Updated: JSON.stringify(updated),
HeaderId:accepId,
clientIp:'<%=clientIp %>'
},
success: function (tipInfo)
{
if (tipInfo) {
$.messager.alert('提示','保存成功!','info');
}
else
$.messager.alert('提示','保存失败!','error');
},
error: function (XmlHttpRequest, textStatus, errorThrown)
{
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
}
});
}
if (endEditing()) {
$('#materialData').datagrid('acceptChanges');
}
}
//获取MaxId
function getMaxId()
{
var depotHeadMax=null;
$.ajax({
type:"post",
url: "<%=path%>/depotHead/getMaxId.action",
//设置为同步
async:false,
dataType: "json",
success: function (systemInfo)
{
if(systemInfo)
{
depotHeadMax = systemInfo.showModel.map.depotHeadMax;
var msgTip = systemInfo.showModel.msgTip;
if(msgTip == "exceptoin")
{
$.messager.alert('提示','查找最大的Id异常,请与管理员联系!','error');
return;
}
}
else
{
depotHeadMax=null;
}
}
});
if(depotHeadMax !=null)
{
if(depotHeadMax.length>0)
{
depotHeadMaxId=depotHeadMax[0];
}
}
}
</script>
</body>
</html>

View File

@ -30,13 +30,13 @@
<span id="orgTipMsg"></span>
</div>
<div class="fitem" style="padding:5px">
<label id="newPassword">密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码&nbsp;&nbsp;</label>
<label id="newPassword">重设密码&nbsp;&nbsp;</label>
<input type="password" name="password" id="password" class="easyui-validatebox" data-options="required:true,validType:'length[5,20]'" style="width: 230px;height: 20px" missingMessage="请填写新密码"/>
<span id="orgTipMsg"></span>
</div>
<div class="fitem" style="padding:5px">
<label id="repasswordLabel">确认密码&nbsp;&nbsp;</label>
<input type="password" name="repassword" id="repassword" class="easyui-validatebox" style="width: 230px;height: 20px" required="true" class="easyui-validatebox" validType="equals['#password']" missingMessage="请再次填写新密码" invalidMessage="确认密码与输入密码不一致"/>
<label id="repasswordLabel">再输一遍&nbsp;&nbsp;</label>
<input type="password" name="repassword" id="repassword" class="easyui-validatebox" style="width: 230px;height: 20px" required="true" class="easyui-validatebox" validType="equals['#password']" missingMessage="请再次填写新密码" invalidMessage="两次密码输入不一致"/>
<span id="tipMsg"></span>
</div>
<input type="hidden" name="clientIp" id="clientIp" value="<%=clientIp %>"/>
@ -58,27 +58,9 @@
return false;
}
});
browserFit();
$("#userDlg").panel({height:webH-35});
});
//浏览器适配
function browserFit()
{
if(getOs()=='MSIE')
{
$("#passwordLabel").empty().append("原始密码&nbsp;&nbsp;");
$("#newPassword").empty().append("密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码&nbsp;&nbsp;");
$("#repasswordLabel").empty().append("确认密码&nbsp;&nbsp;");
}
else
{
$("#passwordLabel").empty().append("原始密码&nbsp;");
$("#newPassword").empty().append("密&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;码&nbsp;");
$("#repasswordLabel").empty().append("确认密码&nbsp;");
}
}
$("#cancelpassword").unbind().bind({
click:function()
{