切换到jsh的版本
This commit is contained in:
@@ -1,955 +0,0 @@
|
||||
//初始化界面
|
||||
var listType = "收预付款";
|
||||
var itemType = true; //隐藏当前列
|
||||
var moneyType = false; //显示当前列
|
||||
var payTypeTitle = "无标题";
|
||||
var inOrOut = "";
|
||||
var amountNum = "SYF";
|
||||
var organUrl = "/supplier/findBySelect_retail"; //散户接口
|
||||
var listTitle='收预付款列表';
|
||||
$(function(){
|
||||
initSystemData_person(); //经手人数据
|
||||
initSelectInfo_person(); //经手人信息
|
||||
initSystemData_account(); //账户数据
|
||||
initSelectInfo_account(); //账户信息
|
||||
initSupplier(); //供应商
|
||||
initTableData();
|
||||
ininPager();
|
||||
initForm();
|
||||
bindEvent();//绑定操作事件
|
||||
$("#searchBtn").click();
|
||||
});
|
||||
//获取账户信息
|
||||
function initSystemData_account(){
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/account/getAccount",
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
if(res.data) {
|
||||
accountList = res.data.accountList;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取账户信息
|
||||
function initSelectInfo_account(){
|
||||
var options = "";
|
||||
if(accountList !=null)
|
||||
{
|
||||
options = "";
|
||||
for(var i = 0 ;i < accountList.length; i++)
|
||||
{
|
||||
var account = accountList[i];
|
||||
options += '<option value="' + account.id + '">' + account.name + '</option>';
|
||||
}
|
||||
$("#AccountId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//初始化单位信息
|
||||
function initSupplier(){
|
||||
$('#OrganId').combobox({
|
||||
url: organUrl,
|
||||
valueField:'id',
|
||||
textField:'supplier',
|
||||
formatter: function(row){
|
||||
var opts = $(this).combobox('options');
|
||||
if(row[opts.textField]!=="非会员") {
|
||||
return row[opts.textField];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//获取财务员
|
||||
function initSystemData_person(){
|
||||
var type = "财务员";
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/person/getPersonByType",
|
||||
data: {
|
||||
type: type
|
||||
},
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
personList = res.data.personList;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取财务员
|
||||
function initSelectInfo_person(){
|
||||
var options = "";
|
||||
|
||||
if(personList !=null)
|
||||
{
|
||||
for(var i = 0 ;i < personList.length;i++)
|
||||
{
|
||||
var person = personList[i];
|
||||
if(0 == i)
|
||||
{
|
||||
personID = person.id;
|
||||
}
|
||||
if(person.type=="财务员")
|
||||
{
|
||||
options += '<option value="' + person.id + '">' + person.name + '</option>';
|
||||
}
|
||||
}
|
||||
$("#HandsPersonId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//防止表单提交重复
|
||||
function initForm(){
|
||||
$('#accountHeadFM').form({
|
||||
onSubmit: function(){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据
|
||||
function initTableData(){
|
||||
var organNameTitle = "付款会员";
|
||||
var organNameHidden = false;
|
||||
$('#tableData').datagrid({
|
||||
//width:700,
|
||||
height:heightInfo,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: 5,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
||||
{ title: '操作',field: 'op',align:"center",width:90,formatter:function(value, rec,index) {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/7 10:48
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js
|
||||
*/
|
||||
var str = '';
|
||||
var orgId = rec.organid ? rec.organid : 0;
|
||||
str += '<img title="查看" src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccountHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.id +',' + orgId +',' + rec.totalprice + ');"/>';
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{ field: 'organid',width:5, hidden:true},
|
||||
{ title: organNameTitle,field: 'organname',width:140,hidden:organNameHidden},
|
||||
{ title: '单据编号',field: 'billno',width:140},
|
||||
{ title: '经手人',field: 'handspersonname',width:80},
|
||||
{ title: '单据时间 ',field: 'billtime',width:140},
|
||||
{ title: '合计',field: 'totalprice',width:80},
|
||||
{ title: '备注',field: 'remark',width:100}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'addAccountHead',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function()
|
||||
{
|
||||
addAccountHead();
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'deleteAccountHead',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function()
|
||||
{
|
||||
batDeleteAccountHead();
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据-明细列表-编辑状态
|
||||
function initTableData_account(type,TotalPrice){
|
||||
$('#accountData').datagrid({
|
||||
height:280,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: payTypeTitle,field: 'InOutItemId',width:230,hidden:itemType,
|
||||
formatter:function(value,row,index){
|
||||
return row.InOutItemName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'InOutItemName',
|
||||
method:'get',
|
||||
url: "/inOutItem/findBySelect?type=" + inOrOut
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '账户名称',field: 'AccountId',width:230,hidden:moneyType,
|
||||
formatter:function(value,row,index){
|
||||
return row.AccountName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'AccountName',
|
||||
method:'get',
|
||||
url: "/account/findBySelect"
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '金额',field: 'EachAmount',editor:'validatebox',width:70},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:150}
|
||||
]],
|
||||
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;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/accountItem/getDetailList',
|
||||
data: {
|
||||
headerId: accountHeadID
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var EachAmount = 0;
|
||||
if(type === "edit") {
|
||||
EachAmount = TotalPrice;
|
||||
}
|
||||
var array = [];
|
||||
array.push({
|
||||
"EachAmount": EachAmount
|
||||
});
|
||||
data.footer = array;
|
||||
$("#accountData").datagrid('loadData',data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//初始化表格数据-明细列表-查看状态
|
||||
function initTableData_account_show(TotalPrice){
|
||||
$('#accountDataShow').datagrid({
|
||||
height:280,
|
||||
rownumbers: true,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ title: payTypeTitle, field: 'InOutItemName', width:230, hidden:itemType},
|
||||
{ title: '账户名称', field: 'AccountName', width:230, hidden:moneyType},
|
||||
{ title: '金额',field: 'EachAmount',width:70},
|
||||
{ title: '备注',field: 'Remark',width:150}
|
||||
]],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/accountItem/getDetailList',
|
||||
data: {
|
||||
headerId: accountHeadID
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var EachAmount = TotalPrice;
|
||||
var array = [];
|
||||
array.push({
|
||||
"EachAmount": EachAmount
|
||||
});
|
||||
data.footer = array;
|
||||
$("#accountDataShow").datagrid('loadData', data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//分页信息处理
|
||||
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
|
||||
});
|
||||
showAccountHeadDetails(pageNum,pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
||||
}
|
||||
}
|
||||
|
||||
//删除财务信息
|
||||
function deleteAccountHead(accountHeadID, thisOrganId, totalPrice){
|
||||
$.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r)
|
||||
{
|
||||
if (r)
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
||||
dataType: "json",
|
||||
data:{
|
||||
ids: accountHeadID
|
||||
},
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=accountHeadID;
|
||||
jsondata.deleteType='2';
|
||||
var type='single';
|
||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
//更新会员的预收款信息
|
||||
if(listType === "收预付款"){
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/supplier/updateAdvanceIn",
|
||||
dataType: "json",
|
||||
data:{
|
||||
supplierId: thisOrganId, //会员id
|
||||
advanceIn: 0-totalPrice //删除时同时删除用户的预付款信息
|
||||
},
|
||||
success: function(res){
|
||||
if(res && res.code === 200) {
|
||||
//保存会员预收款成功
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量删除财务信息
|
||||
function batDeleteAccountHead(){
|
||||
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;
|
||||
}
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
|
||||
//批量删除
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
ids : ids
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked", false);
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=ids;
|
||||
jsondata.deleteType='2';
|
||||
var type='batch';
|
||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
//批量更新会员的预收款信息
|
||||
for(var i = 0;i < row.length; i ++) {
|
||||
if(listType === "收预付款"){
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/supplier/updateAdvanceIn",
|
||||
dataType: "json",
|
||||
data:{
|
||||
supplierId: row[i].organid, //会员id
|
||||
advanceIn: 0 - row[i].totalprice //删除时同时删除用户的预付款信息
|
||||
},
|
||||
success: function(res){
|
||||
if(res && res.code === 200) {
|
||||
//保存会员预收款成功
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
$.messager.alert('提示','保存信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 确认强制删除
|
||||
* */
|
||||
function batDeleteAccountHeadForceConfirm(res,url,jsondata) {
|
||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: (jsondata),
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
if(type=='batch'){
|
||||
$(":checkbox").attr("checked", false);
|
||||
}
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//增加
|
||||
function addAccountHead(){
|
||||
$('#accountHeadFM').form('clear');
|
||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||
$("#BillTime").val(thisDateTime);
|
||||
var thisNumber = getNowFormatDateNum(); //根据时间生成编号
|
||||
$("#BillNo").val(amountNum + thisNumber).focus();
|
||||
var addTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加' + addTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
orgAccountHead = "";
|
||||
accountHeadID = 0;
|
||||
initTableData_account("add"); //明细列表
|
||||
reject(); //撤销下、刷新材料列表
|
||||
url = '/accountHead/addAccountHeadAndDetail';
|
||||
|
||||
//收预付款单据支持刷卡功能
|
||||
if(listType == "收预付款") {
|
||||
//当会员卡号长度超过10位后,自动点击下拉框,用于兼容刷卡器
|
||||
$("#OrganId").next().find("input").off("keyup").on("keyup",function(){
|
||||
if($(this).val().length === 10){
|
||||
setTimeout(function(){
|
||||
$(".combo-panel .combobox-item-selected").click();
|
||||
},500);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//编辑信息
|
||||
function editAccountHead(index){
|
||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#BillNo").val(rowsdata.billno);
|
||||
$("#BillTime").val(rowsdata.billtime);
|
||||
$("#Remark").val(rowsdata.remark);
|
||||
$("#AccountId").val(rowsdata.accountid);
|
||||
$('#OrganId').combobox('setValue', rowsdata.organid);
|
||||
$("#HandsPersonId").val(rowsdata.handspersonid);
|
||||
$("#ChangeAmount").val(rowsdata.changeamount);
|
||||
var TotalPrice = rowsdata.totalprice;
|
||||
preTotalPrice = rowsdata.totalprice; //记录前一次合计金额,用于收预付款
|
||||
var editTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + '/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑' + editTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
accountHeadID = rowsdata.id;
|
||||
|
||||
initTableData_account("edit",TotalPrice); //明细列表
|
||||
reject(); //撤销下、刷新列表
|
||||
url = '/accountHead/updateAccountHeadAndDetail?id=' + rowsdata.id;
|
||||
}
|
||||
|
||||
//查看信息
|
||||
function showAccountHead(index){
|
||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#BillNoShow").text(rowsdata.billno);
|
||||
$("#BillTimeShow").text(rowsdata.billtime);
|
||||
$("#RemarkShow").text(rowsdata.remark);
|
||||
$("#AccountIdShow").text(rowsdata.accountname);
|
||||
$('#OrganIdShow').text(rowsdata.organname);
|
||||
$("#HandsPersonIdShow").text(rowsdata.handspersonname);
|
||||
$("#ChangeAmountShow").text(rowsdata.rowsdata==undefined?'0':rowsdata.rowsdata);
|
||||
var TotalPrice = rowsdata.totalprice;
|
||||
var showTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/list.png"/> 查看' + showTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
accountHeadID = rowsdata.id;
|
||||
initTableData_account_show(TotalPrice); //明细列表-查看状态
|
||||
}
|
||||
|
||||
//绑定操作事件
|
||||
function bindEvent(){
|
||||
//搜索处理
|
||||
$("#searchBtn").unbind().bind({
|
||||
click:function()
|
||||
{
|
||||
showAccountHeadDetails(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
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//重置按钮
|
||||
$("#searchResetBtn").unbind().bind({
|
||||
click:function(){
|
||||
$("#searchBillNo").val("");
|
||||
$("#searchBeginTime").val("");
|
||||
$("#searchEndTime").val("");
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
//保存信息
|
||||
$("#saveAccountHead").off("click").on("click", function () {
|
||||
if(!$('#accountHeadFM').form('validate')){
|
||||
return;
|
||||
} else {
|
||||
if (!$('#HandsPersonId').val()) {
|
||||
$.messager.alert('提示', '请选择经手人!', 'warning');
|
||||
return;
|
||||
}
|
||||
if (!$('#OrganId').combobox('getValue')) {
|
||||
$.messager.alert('提示', '请选择付款会员!', 'warning');
|
||||
return;
|
||||
}
|
||||
var OrganId = null;
|
||||
var ChangeAmount = $.trim($("#ChangeAmount").val());
|
||||
var TotalPrice = $("#accountHeadFM .datagrid-footer [field='EachAmount'] div").text();
|
||||
OrganId = $('#OrganId').combobox('getValue');
|
||||
//更新会员的预收款信息
|
||||
var advanceIn = 0; //预付款金额
|
||||
if (accountHeadID) {
|
||||
advanceIn = TotalPrice - preTotalPrice; //修改时,预付款=合计金额-加载金额
|
||||
}
|
||||
else {
|
||||
advanceIn = TotalPrice; //新增时,预付款=合计金额
|
||||
}
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/supplier/updateAdvanceIn",
|
||||
dataType: "json",
|
||||
data: {
|
||||
supplierId: OrganId,
|
||||
advanceIn: advanceIn
|
||||
},
|
||||
success: function (res) {
|
||||
if (res && res.code === 200) {
|
||||
//保存会员预收款成功
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
$.messager.alert('提示', '保存信息异常,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId);
|
||||
}
|
||||
});
|
||||
|
||||
//打印单据
|
||||
$("#printAccountHeadShow").off("click").on("click",function(){
|
||||
var tableString = $("#accountHeadDlgShow").html();
|
||||
localStorage.setItem("tableString",tableString);
|
||||
window.open("../../js/print/print_form.html","location:No;status:No;help:No;dialogWidth:800px;dialogHeight:600px;scroll:auto;");
|
||||
});
|
||||
|
||||
//初始化键盘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=="BillNo"||obj.id=="BillTime"))
|
||||
{
|
||||
$("#saveAccountHead").click();
|
||||
}
|
||||
//搜索按钮添加快捷键
|
||||
if(k == "13"&&(obj.id=="searchBillNo"))
|
||||
{
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showAccountHeadDetails(pageNo,pageSize){
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/accountHead/list",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
search: JSON.stringify({
|
||||
type: listType,
|
||||
billNo: $.trim($("#searchBillNo").val()),
|
||||
beginTime: $("#searchBeginTime").val(),
|
||||
endTime: $("#searchEndTime").val()
|
||||
}),
|
||||
currentPage: pageNo,
|
||||
pageSize: pageSize
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200){
|
||||
if(res.data && res.data.page) {
|
||||
$("#tableData").datagrid('loadData', res.data.page);
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//自动计算事件
|
||||
function autoReckon() {
|
||||
//延时绑定事件
|
||||
setTimeout(function(){
|
||||
var body =$("#accountHeadFM .datagrid-body");
|
||||
var footer =$("#accountHeadFM .datagrid-footer");
|
||||
var input = ".datagrid-editable-input";
|
||||
|
||||
//修改金额,自动计算单价和合计
|
||||
body.find("[field='EachAmount']").find(input).off("keyup").on("keyup",function(){
|
||||
var TotalPrice = 0;
|
||||
var EachAmount =$(this).val()-0; //金额
|
||||
body.find("[field='EachAmount']").each(function(){
|
||||
if($(this).find("div").text()!==""){
|
||||
TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString());
|
||||
}
|
||||
});
|
||||
TotalPrice = TotalPrice + EachAmount;
|
||||
footer.find("[field='EachAmount']").find("div").text((TotalPrice).toFixed(2));
|
||||
});
|
||||
},500);
|
||||
}
|
||||
|
||||
//结束编辑
|
||||
function endEditing() {
|
||||
var edField = "";
|
||||
if(!itemType){
|
||||
edField = "InOutItemId";
|
||||
edName = "InOutItemName";
|
||||
}
|
||||
else {
|
||||
edField = "AccountId";
|
||||
edName = "AccountName";
|
||||
}
|
||||
if (editIndex == undefined) { return true }
|
||||
if ($('#accountData').datagrid('validateRow', editIndex)) {
|
||||
var ed = $('#accountData').datagrid('getEditor', {index: editIndex, field: edField});
|
||||
var textName =null;
|
||||
if($(ed.target)){
|
||||
textName = $(ed.target).combobox('getText');
|
||||
}
|
||||
$('#accountData').datagrid('getRows')[editIndex][edName] = textName;
|
||||
$('#accountData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//单击
|
||||
function onClickRow(index) {
|
||||
if (editIndex != index) {
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('selectRow', index)
|
||||
.datagrid('beginEdit', index);
|
||||
editIndex = index;
|
||||
autoReckon();
|
||||
} else {
|
||||
$('#accountData').datagrid('selectRow', editIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
//新增
|
||||
function append() {
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('appendRow', {});
|
||||
editIndex = $('#accountData').datagrid('getRows').length - 1;
|
||||
$('#accountData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
||||
autoReckon();
|
||||
}
|
||||
}
|
||||
//删除
|
||||
function removeit() {
|
||||
if (editIndex == undefined) { return }
|
||||
$('#accountData').datagrid('cancelEdit', editIndex)
|
||||
.datagrid('deleteRow', editIndex);
|
||||
editIndex = undefined;
|
||||
}
|
||||
//撤销
|
||||
function reject() {
|
||||
$('#accountData').datagrid('rejectChanges');
|
||||
editIndex = undefined;
|
||||
}
|
||||
//判断
|
||||
function CheckData() {
|
||||
var row = $('#accountData').datagrid('getRows');
|
||||
var totalRowNum = "";
|
||||
for (var i = 0; i < row.length; i++) {
|
||||
if(!itemType){
|
||||
if (row[i].InOutItemId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (row[i].AccountId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (totalRowNum != "") {
|
||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
||||
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
|
||||
if (editIndex != undefined) {
|
||||
$('#accountData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
}
|
||||
if (!CheckData())
|
||||
return false;
|
||||
var inserted = $("#accountData").datagrid('getChanges', "inserted");
|
||||
var deleted = $("#accountData").datagrid('getChanges', "deleted");
|
||||
var updated = $("#accountData").datagrid('getChanges', "updated");
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: {
|
||||
inserted: JSON.stringify(inserted),
|
||||
deleted: JSON.stringify(deleted),
|
||||
updated: JSON.stringify(updated),
|
||||
info : JSON.stringify({
|
||||
Type: listType,
|
||||
BillNo: $.trim($("#BillNo").val()),
|
||||
BillTime: $.trim($("#BillTime").val()),
|
||||
AccountId: $.trim($("#AccountId").val()),
|
||||
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付
|
||||
TotalPrice: TotalPrice, //合计
|
||||
OrganId: OrganId,
|
||||
HandsPersonId: $.trim($("#HandsPersonId").val()),
|
||||
Remark: $.trim($("#Remark").val())
|
||||
}),
|
||||
listType: listType
|
||||
},
|
||||
success: function (tipInfo)
|
||||
{
|
||||
if (tipInfo) {
|
||||
$.messager.alert('提示','保存成功!','info');
|
||||
$('#accountHeadDlg').dialog('close');
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showAccountHeadDetails(opts.pageNumber, opts.pageSize);
|
||||
}
|
||||
else{
|
||||
|
||||
$.messager.show({
|
||||
title: '错误提示',
|
||||
msg: '保存信息失败,请稍后重试!'
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XmlHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -1,856 +0,0 @@
|
||||
//初始化界面
|
||||
var listTitle="转账单列表";
|
||||
var listType = "转账";
|
||||
var itemType = true; //隐藏当前列
|
||||
var moneyType = false; //显示当前列
|
||||
var payTypeTitle = "无标题";
|
||||
var inOrOut = "";
|
||||
var organUrl = "/supplier/findBySelect_cus"; //客户接口
|
||||
var amountNum = "ZZ";
|
||||
$(function(){
|
||||
initSystemData_person(); //经手人数据
|
||||
initSelectInfo_person(); //经手人信息
|
||||
initSystemData_account(); //账户数据
|
||||
initSelectInfo_account(); //账户信息
|
||||
initTableData();
|
||||
ininPager();
|
||||
initForm();
|
||||
bindEvent();//绑定操作事件
|
||||
$("#searchBtn").click();
|
||||
});
|
||||
//获取账户信息
|
||||
function initSystemData_account(){
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/account/getAccount",
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
if(res.data) {
|
||||
accountList = res.data.accountList;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取账户信息
|
||||
function initSelectInfo_account(){
|
||||
var options = "";
|
||||
if(accountList !=null)
|
||||
{
|
||||
options = "";
|
||||
for(var i = 0 ;i < accountList.length; i++)
|
||||
{
|
||||
var account = accountList[i];
|
||||
options += '<option value="' + account.id + '">' + account.name + '</option>';
|
||||
}
|
||||
$("#AccountId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//获取财务员
|
||||
function initSystemData_person(){
|
||||
var type = "财务员";
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/person/getPersonByType",
|
||||
data: {
|
||||
type: type
|
||||
},
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
personList = res.data.personList;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取财务员
|
||||
function initSelectInfo_person(){
|
||||
var options = "";
|
||||
|
||||
if(personList !=null)
|
||||
{
|
||||
for(var i = 0 ;i < personList.length;i++)
|
||||
{
|
||||
var person = personList[i];
|
||||
if(0 == i)
|
||||
{
|
||||
personID = person.id;
|
||||
}
|
||||
if(person.type=="财务员")
|
||||
{
|
||||
options += '<option value="' + person.id + '">' + person.name + '</option>';
|
||||
}
|
||||
}
|
||||
$("#HandsPersonId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//防止表单提交重复
|
||||
function initForm(){
|
||||
$('#accountHeadFM').form({
|
||||
onSubmit: function(){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据
|
||||
function initTableData(){
|
||||
var organNameTitle = "";
|
||||
var organNameHidden = true;
|
||||
$('#tableData').datagrid({
|
||||
//width:700,
|
||||
height:heightInfo,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: 5,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
||||
{ title: '操作',field: 'op',align:"center",width:90,formatter:function(value, rec,index) {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/7 10:48
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js
|
||||
*/
|
||||
var str = '';
|
||||
var orgId = rec.organid ? rec.organid : 0;
|
||||
str += '<img title="查看" src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccountHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.id +',' + orgId +',' + rec.totalprice + ');"/>';
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{ field: 'organid',width:5, hidden:true},
|
||||
{ title: organNameTitle,field: 'organname',width:140,hidden:organNameHidden},
|
||||
{ title: '单据编号',field: 'billno',width:140},
|
||||
{ title: '经手人',field: 'handspersonname',width:80},
|
||||
{ title: '单据时间 ',field: 'billtime',width:140},
|
||||
{ title: '合计',field: 'totalprice',width:80},
|
||||
{ title: '备注',field: 'remark',width:100}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'addAccountHead',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function()
|
||||
{
|
||||
addAccountHead();
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'deleteAccountHead',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function()
|
||||
{
|
||||
batDeleteAccountHead();
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据-明细列表-编辑状态
|
||||
function initTableData_account(type,TotalPrice){
|
||||
$('#accountData').datagrid({
|
||||
height:280,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: payTypeTitle,field: 'InOutItemId',width:230,hidden:itemType,
|
||||
formatter:function(value,row,index){
|
||||
return row.InOutItemName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'InOutItemName',
|
||||
method:'get',
|
||||
url: "/inOutItem/findBySelect?type=" + inOrOut
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '账户名称',field: 'AccountId',width:230,hidden:moneyType,
|
||||
formatter:function(value,row,index){
|
||||
return row.AccountName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'AccountName',
|
||||
method:'get',
|
||||
url: "/account/findBySelect"
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '金额',field: 'EachAmount',editor:'validatebox',width:70},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:150}
|
||||
]],
|
||||
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;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/accountItem/getDetailList',
|
||||
data: {
|
||||
headerId: accountHeadID
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var EachAmount = 0;
|
||||
if(type === "edit") {
|
||||
EachAmount = TotalPrice;
|
||||
}
|
||||
var array = [];
|
||||
array.push({
|
||||
"EachAmount": EachAmount
|
||||
});
|
||||
data.footer = array;
|
||||
$("#accountData").datagrid('loadData',data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//初始化表格数据-明细列表-查看状态
|
||||
function initTableData_account_show(TotalPrice){
|
||||
$('#accountDataShow').datagrid({
|
||||
height:280,
|
||||
rownumbers: true,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ title: payTypeTitle, field: 'InOutItemName', width:230, hidden:itemType},
|
||||
{ title: '账户名称', field: 'AccountName', width:230, hidden:moneyType},
|
||||
{ title: '金额',field: 'EachAmount',width:70},
|
||||
{ title: '备注',field: 'Remark',width:150}
|
||||
]],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/accountItem/getDetailList',
|
||||
data: {
|
||||
headerId: accountHeadID
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var EachAmount = TotalPrice;
|
||||
var array = [];
|
||||
array.push({
|
||||
"EachAmount": EachAmount
|
||||
});
|
||||
data.footer = array;
|
||||
$("#accountDataShow").datagrid('loadData', data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//分页信息处理
|
||||
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
|
||||
});
|
||||
showAccountHeadDetails(pageNum,pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
||||
}
|
||||
}
|
||||
|
||||
//删除财务信息
|
||||
function deleteAccountHead(accountHeadID, thisOrganId, totalPrice){
|
||||
$.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r)
|
||||
{
|
||||
if (r)
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
||||
dataType: "json",
|
||||
data:{
|
||||
ids: accountHeadID
|
||||
},
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=accountHeadID;
|
||||
jsondata.deleteType='2';
|
||||
var type='single';
|
||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量删除财务信息
|
||||
function batDeleteAccountHead(){
|
||||
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;
|
||||
}
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
|
||||
//批量删除
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
ids : ids
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked", false);
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=ids;
|
||||
jsondata.deleteType='2';
|
||||
var type='batch';
|
||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 确认强制删除
|
||||
* */
|
||||
function batDeleteAccountHeadForceConfirm(res,url,jsondata) {
|
||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: (jsondata),
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
if(type=='batch'){
|
||||
$(":checkbox").attr("checked", false);
|
||||
}
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//增加
|
||||
function addAccountHead(){
|
||||
$('#accountHeadFM').form('clear');
|
||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||
$("#BillTime").val(thisDateTime);
|
||||
var thisNumber = getNowFormatDateNum(); //根据时间生成编号
|
||||
$("#BillNo").val(amountNum + thisNumber).focus();
|
||||
var addTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加' + addTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
orgAccountHead = "";
|
||||
accountHeadID = 0;
|
||||
initTableData_account("add"); //明细列表
|
||||
reject(); //撤销下、刷新材料列表
|
||||
url = '/accountHead/addAccountHeadAndDetail';
|
||||
|
||||
}
|
||||
|
||||
//编辑信息
|
||||
function editAccountHead(index){
|
||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#BillNo").val(rowsdata.billno);
|
||||
$("#BillTime").val(rowsdata.billtime);
|
||||
$("#Remark").val(rowsdata.remark);
|
||||
$("#AccountId").val(rowsdata.accountid);
|
||||
// $('#OrganId').combobox('setValue', rowsdata.organid);
|
||||
$("#HandsPersonId").val(rowsdata.handspersonid);
|
||||
$("#ChangeAmount").val(rowsdata.changeamount);
|
||||
var TotalPrice = rowsdata.totalprice;
|
||||
preTotalPrice = rowsdata.totalprice; //记录前一次合计金额,用于收预付款
|
||||
var editTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + '/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑' + editTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
accountHeadID = rowsdata.id;
|
||||
|
||||
initTableData_account("edit",TotalPrice); //明细列表
|
||||
reject(); //撤销下、刷新列表
|
||||
url = '/accountHead/updateAccountHeadAndDetail?id=' + rowsdata.id;
|
||||
}
|
||||
|
||||
//查看信息
|
||||
function showAccountHead(index){
|
||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#BillNoShow").text(rowsdata.billno);
|
||||
$("#BillTimeShow").text(rowsdata.billtime);
|
||||
$("#RemarkShow").text(rowsdata.remark);
|
||||
$("#AccountIdShow").text(rowsdata.accountname);
|
||||
$('#OrganIdShow').text(rowsdata.organname);
|
||||
$("#HandsPersonIdShow").text(rowsdata.handspersonname);
|
||||
$("#ChangeAmountShow").text(rowsdata.rowsdata==undefined?'0':rowsdata.rowsdata);
|
||||
var TotalPrice = rowsdata.totalprice;
|
||||
var showTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/list.png"/> 查看' + showTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
accountHeadID = rowsdata.id;
|
||||
initTableData_account_show(TotalPrice); //明细列表-查看状态
|
||||
}
|
||||
|
||||
//绑定操作事件
|
||||
function bindEvent(){
|
||||
//搜索处理
|
||||
$("#searchBtn").unbind().bind({
|
||||
click:function()
|
||||
{
|
||||
showAccountHeadDetails(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
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//重置按钮
|
||||
$("#searchResetBtn").unbind().bind({
|
||||
click:function(){
|
||||
$("#searchBillNo").val("");
|
||||
$("#searchBeginTime").val("");
|
||||
$("#searchEndTime").val("");
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
//保存信息
|
||||
$("#saveAccountHead").off("click").on("click", function () {
|
||||
if(!$('#accountHeadFM').form('validate')){
|
||||
return;
|
||||
} else {
|
||||
if (!$('#HandsPersonId').val()) {
|
||||
$.messager.alert('提示', '请选择经手人!', 'warning');
|
||||
return;
|
||||
}
|
||||
if (!$('#AccountId').val()) {
|
||||
$.messager.alert('提示', '请选择付款账户!', 'warning');
|
||||
return;
|
||||
}
|
||||
var OrganId = null;
|
||||
var ChangeAmount = $.trim($("#ChangeAmount").val());
|
||||
var TotalPrice = $("#accountHeadFM .datagrid-footer [field='EachAmount'] div").text();
|
||||
//支出为负数
|
||||
ChangeAmount = 0 - ChangeAmount;
|
||||
//支出和付款为负数
|
||||
TotalPrice = 0 - TotalPrice;
|
||||
saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId);
|
||||
}
|
||||
});
|
||||
|
||||
//打印单据
|
||||
$("#printAccountHeadShow").off("click").on("click",function(){
|
||||
var tableString = $("#accountHeadDlgShow").html();
|
||||
localStorage.setItem("tableString",tableString);
|
||||
window.open("../../js/print/print_form.html","location:No;status:No;help:No;dialogWidth:800px;dialogHeight:600px;scroll:auto;");
|
||||
});
|
||||
|
||||
//初始化键盘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=="BillNo"||obj.id=="BillTime"))
|
||||
{
|
||||
$("#saveAccountHead").click();
|
||||
}
|
||||
//搜索按钮添加快捷键
|
||||
if(k == "13"&&(obj.id=="searchBillNo"))
|
||||
{
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showAccountHeadDetails(pageNo,pageSize){
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/accountHead/list",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
search: JSON.stringify({
|
||||
type: listType,
|
||||
billNo: $.trim($("#searchBillNo").val()),
|
||||
beginTime: $("#searchBeginTime").val(),
|
||||
endTime: $("#searchEndTime").val()
|
||||
}),
|
||||
currentPage: pageNo,
|
||||
pageSize: pageSize
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200){
|
||||
if(res.data && res.data.page) {
|
||||
$("#tableData").datagrid('loadData', res.data.page);
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//自动计算事件
|
||||
function autoReckon() {
|
||||
//延时绑定事件
|
||||
setTimeout(function(){
|
||||
var body =$("#accountHeadFM .datagrid-body");
|
||||
var footer =$("#accountHeadFM .datagrid-footer");
|
||||
var input = ".datagrid-editable-input";
|
||||
|
||||
//修改金额,自动计算单价和合计
|
||||
body.find("[field='EachAmount']").find(input).off("keyup").on("keyup",function(){
|
||||
var TotalPrice = 0;
|
||||
var EachAmount =$(this).val()-0; //金额
|
||||
body.find("[field='EachAmount']").each(function(){
|
||||
if($(this).find("div").text()!==""){
|
||||
TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString());
|
||||
}
|
||||
});
|
||||
TotalPrice = TotalPrice + EachAmount;
|
||||
footer.find("[field='EachAmount']").find("div").text((TotalPrice).toFixed(2));
|
||||
});
|
||||
},500);
|
||||
}
|
||||
|
||||
//结束编辑
|
||||
function endEditing() {
|
||||
var edField = "";
|
||||
if(!itemType){
|
||||
edField = "InOutItemId";
|
||||
edName = "InOutItemName";
|
||||
}
|
||||
else {
|
||||
edField = "AccountId";
|
||||
edName = "AccountName";
|
||||
}
|
||||
if (editIndex == undefined) { return true }
|
||||
if ($('#accountData').datagrid('validateRow', editIndex)) {
|
||||
var ed = $('#accountData').datagrid('getEditor', {index: editIndex, field: edField});
|
||||
var textName =null;
|
||||
if($(ed.target)){
|
||||
textName = $(ed.target).combobox('getText');
|
||||
}
|
||||
$('#accountData').datagrid('getRows')[editIndex][edName] = textName;
|
||||
$('#accountData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//单击
|
||||
function onClickRow(index) {
|
||||
if (editIndex != index) {
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('selectRow', index)
|
||||
.datagrid('beginEdit', index);
|
||||
editIndex = index;
|
||||
autoReckon();
|
||||
} else {
|
||||
$('#accountData').datagrid('selectRow', editIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
//新增
|
||||
function append() {
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('appendRow', {});
|
||||
editIndex = $('#accountData').datagrid('getRows').length - 1;
|
||||
$('#accountData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
||||
autoReckon();
|
||||
}
|
||||
}
|
||||
//删除
|
||||
function removeit() {
|
||||
if (editIndex == undefined) { return }
|
||||
$('#accountData').datagrid('cancelEdit', editIndex)
|
||||
.datagrid('deleteRow', editIndex);
|
||||
editIndex = undefined;
|
||||
}
|
||||
//撤销
|
||||
function reject() {
|
||||
$('#accountData').datagrid('rejectChanges');
|
||||
editIndex = undefined;
|
||||
}
|
||||
//判断
|
||||
function CheckData() {
|
||||
var row = $('#accountData').datagrid('getRows');
|
||||
var totalRowNum = "";
|
||||
for (var i = 0; i < row.length; i++) {
|
||||
if(!itemType){
|
||||
if (row[i].InOutItemId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (row[i].AccountId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (totalRowNum != "") {
|
||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
||||
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
|
||||
if (editIndex != undefined) {
|
||||
$('#accountData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
}
|
||||
if (!CheckData())
|
||||
return false;
|
||||
var inserted = $("#accountData").datagrid('getChanges', "inserted");
|
||||
var deleted = $("#accountData").datagrid('getChanges', "deleted");
|
||||
var updated = $("#accountData").datagrid('getChanges', "updated");
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: {
|
||||
inserted: JSON.stringify(inserted),
|
||||
deleted: JSON.stringify(deleted),
|
||||
updated: JSON.stringify(updated),
|
||||
info : JSON.stringify({
|
||||
Type: listType,
|
||||
BillNo: $.trim($("#BillNo").val()),
|
||||
BillTime: $.trim($("#BillTime").val()),
|
||||
AccountId: $.trim($("#AccountId").val()),
|
||||
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付
|
||||
TotalPrice: TotalPrice, //合计
|
||||
OrganId: OrganId,
|
||||
HandsPersonId: $.trim($("#HandsPersonId").val()),
|
||||
Remark: $.trim($("#Remark").val())
|
||||
}),
|
||||
listType: listType
|
||||
},
|
||||
success: function (tipInfo)
|
||||
{
|
||||
if (tipInfo) {
|
||||
$.messager.alert('提示','保存成功!','info');
|
||||
$('#accountHeadDlg').dialog('close');
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showAccountHeadDetails(opts.pageNumber, opts.pageSize);
|
||||
}
|
||||
else{
|
||||
|
||||
$.messager.show({
|
||||
title: '错误提示',
|
||||
msg: '保存信息失败,请稍后重试!'
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XmlHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,872 +0,0 @@
|
||||
//初始化界面
|
||||
var listTitle ="收入单列表"
|
||||
var listType = "收入";
|
||||
var itemType = false; //显示当前列
|
||||
var moneyType = true; //隐藏当前列
|
||||
var payTypeTitle = "收入项目";
|
||||
var inOrOut = "in";
|
||||
var organUrl = "/supplier/findBySelect_cus"; //客户接口
|
||||
var amountNum = "SR";
|
||||
$(function(){
|
||||
initSystemData_person(); //经手人数据
|
||||
initSelectInfo_person(); //经手人信息
|
||||
initSystemData_account(); //账户数据
|
||||
initSelectInfo_account(); //账户信息
|
||||
initSupplier(); //供应商
|
||||
initTableData();
|
||||
ininPager();
|
||||
initForm();
|
||||
bindEvent();//绑定操作事件
|
||||
$("#searchBtn").click();
|
||||
});
|
||||
//获取账户信息
|
||||
function initSystemData_account(){
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/account/getAccount",
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
if(res.data) {
|
||||
accountList = res.data.accountList;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取账户信息
|
||||
function initSelectInfo_account(){
|
||||
var options = "";
|
||||
if(accountList !=null)
|
||||
{
|
||||
options = "";
|
||||
for(var i = 0 ;i < accountList.length; i++)
|
||||
{
|
||||
var account = accountList[i];
|
||||
options += '<option value="' + account.id + '">' + account.name + '</option>';
|
||||
}
|
||||
$("#AccountId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//初始化单位信息
|
||||
function initSupplier(){
|
||||
$('#OrganId').combobox({
|
||||
url: organUrl,
|
||||
valueField:'id',
|
||||
textField:'supplier',
|
||||
formatter: function(row){
|
||||
var opts = $(this).combobox('options');
|
||||
if(row[opts.textField]!=="非会员") {
|
||||
return row[opts.textField];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//获取财务员
|
||||
function initSystemData_person(){
|
||||
var type = "财务员";
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/person/getPersonByType",
|
||||
data: {
|
||||
type: type
|
||||
},
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
personList = res.data.personList;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取财务员
|
||||
function initSelectInfo_person(){
|
||||
var options = "";
|
||||
|
||||
if(personList !=null)
|
||||
{
|
||||
for(var i = 0 ;i < personList.length;i++)
|
||||
{
|
||||
var person = personList[i];
|
||||
if(0 == i)
|
||||
{
|
||||
personID = person.id;
|
||||
}
|
||||
if(person.type=="财务员")
|
||||
{
|
||||
options += '<option value="' + person.id + '">' + person.name + '</option>';
|
||||
}
|
||||
}
|
||||
$("#HandsPersonId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//防止表单提交重复
|
||||
function initForm(){
|
||||
$('#accountHeadFM').form({
|
||||
onSubmit: function(){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据
|
||||
function initTableData(){
|
||||
var organNameTitle = "往来单位";
|
||||
var organNameHidden = false;
|
||||
$('#tableData').datagrid({
|
||||
//width:700,
|
||||
height:heightInfo,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: 5,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
||||
{ title: '操作',field: 'op',align:"center",width:90,formatter:function(value, rec,index) {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/7 10:48
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js
|
||||
*/
|
||||
var str = '';
|
||||
var orgId = rec.organid ? rec.organid : 0;
|
||||
str += '<img title="查看" src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccountHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.id +',' + orgId +',' + rec.totalprice + ');"/>';
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{ field: 'organid',width:5, hidden:true},
|
||||
{ title: organNameTitle,field: 'organname',width:140,hidden:organNameHidden},
|
||||
{ title: '单据编号',field: 'billno',width:140},
|
||||
{ title: '经手人',field: 'handspersonname',width:80},
|
||||
{ title: '单据时间 ',field: 'billtime',width:140},
|
||||
{ title: '合计',field: 'totalprice',width:80},
|
||||
{ title: '备注',field: 'remark',width:100}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'addAccountHead',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function()
|
||||
{
|
||||
addAccountHead();
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'deleteAccountHead',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function()
|
||||
{
|
||||
batDeleteAccountHead();
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据-明细列表-编辑状态
|
||||
function initTableData_account(type,TotalPrice){
|
||||
$('#accountData').datagrid({
|
||||
height:280,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: payTypeTitle,field: 'InOutItemId',width:230,hidden:itemType,
|
||||
formatter:function(value,row,index){
|
||||
return row.InOutItemName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'InOutItemName',
|
||||
method:'get',
|
||||
url: "/inOutItem/findBySelect?type=" + inOrOut
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '账户名称',field: 'AccountId',width:230,hidden:moneyType,
|
||||
formatter:function(value,row,index){
|
||||
return row.AccountName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'AccountName',
|
||||
method:'get',
|
||||
url: "/account/findBySelect"
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '金额',field: 'EachAmount',editor:'validatebox',width:70},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:150}
|
||||
]],
|
||||
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;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/accountItem/getDetailList',
|
||||
data: {
|
||||
headerId: accountHeadID
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var EachAmount = 0;
|
||||
if(type === "edit") {
|
||||
EachAmount = TotalPrice;
|
||||
}
|
||||
var array = [];
|
||||
array.push({
|
||||
"EachAmount": EachAmount
|
||||
});
|
||||
data.footer = array;
|
||||
$("#accountData").datagrid('loadData',data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//初始化表格数据-明细列表-查看状态
|
||||
function initTableData_account_show(TotalPrice){
|
||||
$('#accountDataShow').datagrid({
|
||||
height:280,
|
||||
rownumbers: true,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ title: payTypeTitle, field: 'InOutItemName', width:230, hidden:itemType},
|
||||
{ title: '账户名称', field: 'AccountName', width:230, hidden:moneyType},
|
||||
{ title: '金额',field: 'EachAmount',width:70},
|
||||
{ title: '备注',field: 'Remark',width:150}
|
||||
]],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/accountItem/getDetailList',
|
||||
data: {
|
||||
headerId: accountHeadID
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var EachAmount = TotalPrice;
|
||||
var array = [];
|
||||
array.push({
|
||||
"EachAmount": EachAmount
|
||||
});
|
||||
data.footer = array;
|
||||
$("#accountDataShow").datagrid('loadData', data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//分页信息处理
|
||||
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
|
||||
});
|
||||
showAccountHeadDetails(pageNum,pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
||||
}
|
||||
}
|
||||
|
||||
//删除财务信息
|
||||
function deleteAccountHead(accountHeadID, thisOrganId, totalPrice){
|
||||
$.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r)
|
||||
{
|
||||
if (r)
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
||||
dataType: "json",
|
||||
data:{
|
||||
ids: accountHeadID
|
||||
},
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=accountHeadID;
|
||||
jsondata.deleteType='2';
|
||||
var type='single';
|
||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量删除财务信息
|
||||
function batDeleteAccountHead(){
|
||||
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;
|
||||
}
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
|
||||
//批量删除
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
ids : ids
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked", false);
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=ids;
|
||||
jsondata.deleteType='2';
|
||||
var type='batch';
|
||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 确认强制删除
|
||||
* */
|
||||
function batDeleteAccountHeadForceConfirm(res,url,jsondata) {
|
||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: (jsondata),
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
if(type=='batch'){
|
||||
$(":checkbox").attr("checked", false);
|
||||
}
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//增加
|
||||
function addAccountHead(){
|
||||
$('#accountHeadFM').form('clear');
|
||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||
$("#BillTime").val(thisDateTime);
|
||||
var thisNumber = getNowFormatDateNum(); //根据时间生成编号
|
||||
$("#BillNo").val(amountNum + thisNumber).focus();
|
||||
var addTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加' + addTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
orgAccountHead = "";
|
||||
accountHeadID = 0;
|
||||
initTableData_account("add"); //明细列表
|
||||
reject(); //撤销下、刷新材料列表
|
||||
url = '/accountHead/addAccountHeadAndDetail';
|
||||
|
||||
}
|
||||
|
||||
//编辑信息
|
||||
function editAccountHead(index){
|
||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#BillNo").val(rowsdata.billno);
|
||||
$("#BillTime").val(rowsdata.billtime);
|
||||
$("#Remark").val(rowsdata.remark);
|
||||
$("#AccountId").val(rowsdata.accountid);
|
||||
$('#OrganId').combobox('setValue', rowsdata.organid);
|
||||
$("#HandsPersonId").val(rowsdata.handspersonid);
|
||||
$("#ChangeAmount").val(rowsdata.changeamount);
|
||||
var TotalPrice = rowsdata.totalprice;
|
||||
preTotalPrice = rowsdata.totalprice; //记录前一次合计金额,用于收预付款
|
||||
var editTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + '/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑' + editTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
accountHeadID = rowsdata.id;
|
||||
|
||||
initTableData_account("edit",TotalPrice); //明细列表
|
||||
reject(); //撤销下、刷新列表
|
||||
url = '/accountHead/updateAccountHeadAndDetail?id=' + rowsdata.id;
|
||||
}
|
||||
|
||||
//查看信息
|
||||
function showAccountHead(index){
|
||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#BillNoShow").text(rowsdata.billno);
|
||||
$("#BillTimeShow").text(rowsdata.billtime);
|
||||
$("#RemarkShow").text(rowsdata.remark);
|
||||
$("#AccountIdShow").text(rowsdata.accountname);
|
||||
$('#OrganIdShow').text(rowsdata.organname);
|
||||
$("#HandsPersonIdShow").text(rowsdata.handspersonname);
|
||||
$("#ChangeAmountShow").text(rowsdata.rowsdata==undefined?'0':rowsdata.rowsdata);
|
||||
var TotalPrice = rowsdata.totalprice;
|
||||
var showTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/list.png"/> 查看' + showTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
accountHeadID = rowsdata.id;
|
||||
initTableData_account_show(TotalPrice); //明细列表-查看状态
|
||||
}
|
||||
|
||||
//绑定操作事件
|
||||
function bindEvent(){
|
||||
//搜索处理
|
||||
$("#searchBtn").unbind().bind({
|
||||
click:function()
|
||||
{
|
||||
showAccountHeadDetails(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
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//重置按钮
|
||||
$("#searchResetBtn").unbind().bind({
|
||||
click:function(){
|
||||
$("#searchBillNo").val("");
|
||||
$("#searchBeginTime").val("");
|
||||
$("#searchEndTime").val("");
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
//保存信息
|
||||
$("#saveAccountHead").off("click").on("click", function () {
|
||||
if(!$('#accountHeadFM').form('validate')){
|
||||
return;
|
||||
} else {
|
||||
if (!$('#AccountId').val()) {
|
||||
$.messager.alert('提示', '请选择收款账户!', 'warning');
|
||||
return;
|
||||
}
|
||||
if (!$('#OrganId').combobox('getValue')) {
|
||||
$.messager.alert('提示', '请选择往来单位!', 'warning');
|
||||
return;
|
||||
}
|
||||
if (!$('#HandsPersonId').val()) {
|
||||
$.messager.alert('提示', '请选择经手人!', 'warning');
|
||||
return;
|
||||
}
|
||||
var ChangeAmount = $.trim($("#ChangeAmount").val());
|
||||
var TotalPrice = $("#accountHeadFM .datagrid-footer [field='EachAmount'] div").text();
|
||||
var OrganId = $('#OrganId').combobox('getValue');
|
||||
|
||||
saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId);
|
||||
}
|
||||
});
|
||||
|
||||
//打印单据
|
||||
$("#printAccountHeadShow").off("click").on("click",function(){
|
||||
var tableString = $("#accountHeadDlgShow").html();
|
||||
localStorage.setItem("tableString",tableString);
|
||||
window.open("../../js/print/print_form.html","location:No;status:No;help:No;dialogWidth:800px;dialogHeight:600px;scroll:auto;");
|
||||
});
|
||||
|
||||
//初始化键盘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=="BillNo"||obj.id=="BillTime"))
|
||||
{
|
||||
$("#saveAccountHead").click();
|
||||
}
|
||||
//搜索按钮添加快捷键
|
||||
if(k == "13"&&(obj.id=="searchBillNo"))
|
||||
{
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showAccountHeadDetails(pageNo,pageSize){
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/accountHead/list",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
search: JSON.stringify({
|
||||
type: listType,
|
||||
billNo: $.trim($("#searchBillNo").val()),
|
||||
beginTime: $("#searchBeginTime").val(),
|
||||
endTime: $("#searchEndTime").val()
|
||||
}),
|
||||
currentPage: pageNo,
|
||||
pageSize: pageSize
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200){
|
||||
if(res.data && res.data.page) {
|
||||
$("#tableData").datagrid('loadData', res.data.page);
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//自动计算事件
|
||||
function autoReckon() {
|
||||
//延时绑定事件
|
||||
setTimeout(function(){
|
||||
var body =$("#accountHeadFM .datagrid-body");
|
||||
var footer =$("#accountHeadFM .datagrid-footer");
|
||||
var input = ".datagrid-editable-input";
|
||||
|
||||
//修改金额,自动计算单价和合计
|
||||
body.find("[field='EachAmount']").find(input).off("keyup").on("keyup",function(){
|
||||
var TotalPrice = 0;
|
||||
var EachAmount =$(this).val()-0; //金额
|
||||
body.find("[field='EachAmount']").each(function(){
|
||||
if($(this).find("div").text()!==""){
|
||||
TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString());
|
||||
}
|
||||
});
|
||||
TotalPrice = TotalPrice + EachAmount;
|
||||
footer.find("[field='EachAmount']").find("div").text((TotalPrice).toFixed(2));
|
||||
});
|
||||
},500);
|
||||
}
|
||||
|
||||
//结束编辑
|
||||
function endEditing() {
|
||||
var edField = "";
|
||||
if(!itemType){
|
||||
edField = "InOutItemId";
|
||||
edName = "InOutItemName";
|
||||
}
|
||||
else {
|
||||
edField = "AccountId";
|
||||
edName = "AccountName";
|
||||
}
|
||||
if (editIndex == undefined) { return true }
|
||||
if ($('#accountData').datagrid('validateRow', editIndex)) {
|
||||
var ed = $('#accountData').datagrid('getEditor', {index: editIndex, field: edField});
|
||||
var textName =null;
|
||||
if($(ed.target)){
|
||||
textName = $(ed.target).combobox('getText');
|
||||
}
|
||||
$('#accountData').datagrid('getRows')[editIndex][edName] = textName;
|
||||
$('#accountData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//单击
|
||||
function onClickRow(index) {
|
||||
if (editIndex != index) {
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('selectRow', index)
|
||||
.datagrid('beginEdit', index);
|
||||
editIndex = index;
|
||||
autoReckon();
|
||||
} else {
|
||||
$('#accountData').datagrid('selectRow', editIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
//新增
|
||||
function append() {
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('appendRow', {});
|
||||
editIndex = $('#accountData').datagrid('getRows').length - 1;
|
||||
$('#accountData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
||||
autoReckon();
|
||||
}
|
||||
}
|
||||
//删除
|
||||
function removeit() {
|
||||
if (editIndex == undefined) { return }
|
||||
$('#accountData').datagrid('cancelEdit', editIndex)
|
||||
.datagrid('deleteRow', editIndex);
|
||||
editIndex = undefined;
|
||||
}
|
||||
//撤销
|
||||
function reject() {
|
||||
$('#accountData').datagrid('rejectChanges');
|
||||
editIndex = undefined;
|
||||
}
|
||||
//判断
|
||||
function CheckData() {
|
||||
var row = $('#accountData').datagrid('getRows');
|
||||
var totalRowNum = "";
|
||||
for (var i = 0; i < row.length; i++) {
|
||||
if(!itemType){
|
||||
if (row[i].InOutItemId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (row[i].AccountId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (totalRowNum != "") {
|
||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
||||
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
|
||||
if (editIndex != undefined) {
|
||||
$('#accountData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
}
|
||||
if (!CheckData())
|
||||
return false;
|
||||
var inserted = $("#accountData").datagrid('getChanges', "inserted");
|
||||
var deleted = $("#accountData").datagrid('getChanges', "deleted");
|
||||
var updated = $("#accountData").datagrid('getChanges', "updated");
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: {
|
||||
inserted: JSON.stringify(inserted),
|
||||
deleted: JSON.stringify(deleted),
|
||||
updated: JSON.stringify(updated),
|
||||
info : JSON.stringify({
|
||||
Type: listType,
|
||||
BillNo: $.trim($("#BillNo").val()),
|
||||
BillTime: $.trim($("#BillTime").val()),
|
||||
AccountId: $.trim($("#AccountId").val()),
|
||||
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付
|
||||
TotalPrice: TotalPrice, //合计
|
||||
OrganId: OrganId,
|
||||
HandsPersonId: $.trim($("#HandsPersonId").val()),
|
||||
Remark: $.trim($("#Remark").val())
|
||||
}),
|
||||
listType: listType
|
||||
},
|
||||
success: function (tipInfo)
|
||||
{
|
||||
if (tipInfo) {
|
||||
$.messager.alert('提示','保存成功!','info');
|
||||
$('#accountHeadDlg').dialog('close');
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showAccountHeadDetails(opts.pageNumber, opts.pageSize);
|
||||
}
|
||||
else{
|
||||
|
||||
$.messager.show({
|
||||
title: '错误提示',
|
||||
msg: '保存信息失败,请稍后重试!'
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XmlHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,878 +0,0 @@
|
||||
//初始化界面
|
||||
var listTitle ="支出单列表";
|
||||
var listType = "支出";
|
||||
var itemType = false; //显示当前列
|
||||
var moneyType = true; //隐藏当前列
|
||||
var payTypeTitle = "支出项目";
|
||||
var inOrOut = "out";
|
||||
var organUrl = "/supplier/findBySelect_sup"; //供应商接口
|
||||
var amountNum = "ZC";
|
||||
$(function(){
|
||||
initSystemData_person(); //经手人数据
|
||||
initSelectInfo_person(); //经手人信息
|
||||
initSystemData_account(); //账户数据
|
||||
initSelectInfo_account(); //账户信息
|
||||
initSupplier(); //供应商
|
||||
initTableData();
|
||||
ininPager();
|
||||
initForm();
|
||||
bindEvent();//绑定操作事件
|
||||
$("#searchBtn").click();
|
||||
});
|
||||
|
||||
//获取账户信息
|
||||
function initSystemData_account(){
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/account/getAccount",
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
if(res.data) {
|
||||
accountList = res.data.accountList;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取账户信息
|
||||
function initSelectInfo_account(){
|
||||
var options = "";
|
||||
if(accountList !=null)
|
||||
{
|
||||
options = "";
|
||||
for(var i = 0 ;i < accountList.length; i++)
|
||||
{
|
||||
var account = accountList[i];
|
||||
options += '<option value="' + account.id + '">' + account.name + '</option>';
|
||||
}
|
||||
$("#AccountId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//初始化单位信息
|
||||
function initSupplier(){
|
||||
$('#OrganId').combobox({
|
||||
url: organUrl,
|
||||
valueField:'id',
|
||||
textField:'supplier',
|
||||
formatter: function(row){
|
||||
var opts = $(this).combobox('options');
|
||||
if(row[opts.textField]!=="非会员") {
|
||||
return row[opts.textField];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//获取财务员
|
||||
function initSystemData_person(){
|
||||
var type = "财务员";
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/person/getPersonByType",
|
||||
data: {
|
||||
type: type
|
||||
},
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
personList = res.data.personList;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取财务员
|
||||
function initSelectInfo_person(){
|
||||
var options = "";
|
||||
|
||||
if(personList !=null)
|
||||
{
|
||||
for(var i = 0 ;i < personList.length;i++)
|
||||
{
|
||||
var person = personList[i];
|
||||
if(0 == i)
|
||||
{
|
||||
personID = person.id;
|
||||
}
|
||||
if(person.type=="财务员")
|
||||
{
|
||||
options += '<option value="' + person.id + '">' + person.name + '</option>';
|
||||
}
|
||||
}
|
||||
$("#HandsPersonId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//防止表单提交重复
|
||||
function initForm(){
|
||||
$('#accountHeadFM').form({
|
||||
onSubmit: function(){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据
|
||||
function initTableData(){
|
||||
var organNameTitle = "往来单位";
|
||||
var organNameHidden = false;
|
||||
$('#tableData').datagrid({
|
||||
//width:700,
|
||||
height:heightInfo,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: 5,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
||||
{ title: '操作',field: 'op',align:"center",width:90,formatter:function(value, rec,index) {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/7 10:48
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js
|
||||
*/
|
||||
var str = '';
|
||||
var orgId = rec.organid ? rec.organid : 0;
|
||||
str += '<img title="查看" src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccountHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.id +',' + orgId +',' + rec.totalprice + ');"/>';
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{ field: 'organid',width:5, hidden:true},
|
||||
{ title: organNameTitle,field: 'organname',width:140,hidden:organNameHidden},
|
||||
{ title: '单据编号',field: 'billno',width:140},
|
||||
{ title: '经手人',field: 'handspersonname',width:80},
|
||||
{ title: '单据时间 ',field: 'billtime',width:140},
|
||||
{ title: '合计',field: 'totalprice',width:80},
|
||||
{ title: '备注',field: 'remark',width:100}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'addAccountHead',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function()
|
||||
{
|
||||
addAccountHead();
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'deleteAccountHead',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function()
|
||||
{
|
||||
batDeleteAccountHead();
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据-明细列表-编辑状态
|
||||
function initTableData_account(type,TotalPrice){
|
||||
$('#accountData').datagrid({
|
||||
height:280,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: payTypeTitle,field: 'InOutItemId',width:230,hidden:itemType,
|
||||
formatter:function(value,row,index){
|
||||
return row.InOutItemName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'InOutItemName',
|
||||
method:'get',
|
||||
url: "/inOutItem/findBySelect?type=" + inOrOut
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '账户名称',field: 'AccountId',width:230,hidden:moneyType,
|
||||
formatter:function(value,row,index){
|
||||
return row.AccountName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'AccountName',
|
||||
method:'get',
|
||||
url: "/account/findBySelect"
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '金额',field: 'EachAmount',editor:'validatebox',width:70},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:150}
|
||||
]],
|
||||
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;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/accountItem/getDetailList',
|
||||
data: {
|
||||
headerId: accountHeadID
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var EachAmount = 0;
|
||||
if(type === "edit") {
|
||||
EachAmount = TotalPrice;
|
||||
}
|
||||
var array = [];
|
||||
array.push({
|
||||
"EachAmount": EachAmount
|
||||
});
|
||||
data.footer = array;
|
||||
$("#accountData").datagrid('loadData',data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//初始化表格数据-明细列表-查看状态
|
||||
function initTableData_account_show(TotalPrice){
|
||||
$('#accountDataShow').datagrid({
|
||||
height:280,
|
||||
rownumbers: true,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ title: payTypeTitle, field: 'InOutItemName', width:230, hidden:itemType},
|
||||
{ title: '账户名称', field: 'AccountName', width:230, hidden:moneyType},
|
||||
{ title: '金额',field: 'EachAmount',width:70},
|
||||
{ title: '备注',field: 'Remark',width:150}
|
||||
]],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/accountItem/getDetailList',
|
||||
data: {
|
||||
headerId: accountHeadID
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var EachAmount = TotalPrice;
|
||||
var array = [];
|
||||
array.push({
|
||||
"EachAmount": EachAmount
|
||||
});
|
||||
data.footer = array;
|
||||
$("#accountDataShow").datagrid('loadData', data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//分页信息处理
|
||||
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
|
||||
});
|
||||
showAccountHeadDetails(pageNum,pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
||||
}
|
||||
}
|
||||
|
||||
//删除财务信息
|
||||
function deleteAccountHead(accountHeadID, thisOrganId, totalPrice){
|
||||
$.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r)
|
||||
{
|
||||
if (r)
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
||||
dataType: "json",
|
||||
data:{
|
||||
ids: accountHeadID
|
||||
},
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=accountHeadID;
|
||||
jsondata.deleteType='2';
|
||||
var type='single';
|
||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量删除财务信息
|
||||
function batDeleteAccountHead(){
|
||||
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;
|
||||
}
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
|
||||
//批量删除
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
ids : ids
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked", false);
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=ids;
|
||||
jsondata.deleteType='2';
|
||||
var type='batch';
|
||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 确认强制删除
|
||||
* */
|
||||
function batDeleteAccountHeadForceConfirm(res,url,jsondata) {
|
||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: (jsondata),
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
if(type=='batch'){
|
||||
$(":checkbox").attr("checked", false);
|
||||
}
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//增加
|
||||
function addAccountHead(){
|
||||
$('#accountHeadFM').form('clear');
|
||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||
$("#BillTime").val(thisDateTime);
|
||||
var thisNumber = getNowFormatDateNum(); //根据时间生成编号
|
||||
$("#BillNo").val(amountNum + thisNumber).focus();
|
||||
var addTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加' + addTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
orgAccountHead = "";
|
||||
accountHeadID = 0;
|
||||
initTableData_account("add"); //明细列表
|
||||
reject(); //撤销下、刷新材料列表
|
||||
url = '/accountHead/addAccountHeadAndDetail';
|
||||
|
||||
}
|
||||
|
||||
//编辑信息
|
||||
function editAccountHead(index){
|
||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#BillNo").val(rowsdata.billno);
|
||||
$("#BillTime").val(rowsdata.billtime);
|
||||
$("#Remark").val(rowsdata.remark);
|
||||
$("#AccountId").val(rowsdata.accountid);
|
||||
$('#OrganId').combobox('setValue', rowsdata.organid);
|
||||
$("#HandsPersonId").val(rowsdata.handspersonid);
|
||||
$("#ChangeAmount").val(rowsdata.changeamount);
|
||||
var TotalPrice = rowsdata.totalprice;
|
||||
preTotalPrice = rowsdata.totalprice; //记录前一次合计金额,用于收预付款
|
||||
var editTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + '/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑' + editTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
accountHeadID = rowsdata.id;
|
||||
|
||||
initTableData_account("edit",TotalPrice); //明细列表
|
||||
reject(); //撤销下、刷新列表
|
||||
url = '/accountHead/updateAccountHeadAndDetail?id=' + rowsdata.id;
|
||||
}
|
||||
|
||||
//查看信息
|
||||
function showAccountHead(index){
|
||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#BillNoShow").text(rowsdata.billno);
|
||||
$("#BillTimeShow").text(rowsdata.billtime);
|
||||
$("#RemarkShow").text(rowsdata.remark);
|
||||
$("#AccountIdShow").text(rowsdata.accountname);
|
||||
$('#OrganIdShow').text(rowsdata.organname);
|
||||
$("#HandsPersonIdShow").text(rowsdata.handspersonname);
|
||||
$("#ChangeAmountShow").text(rowsdata.rowsdata==undefined?'0':rowsdata.rowsdata);
|
||||
var TotalPrice = rowsdata.totalprice;
|
||||
var showTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/list.png"/> 查看' + showTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
accountHeadID = rowsdata.id;
|
||||
initTableData_account_show(TotalPrice); //明细列表-查看状态
|
||||
}
|
||||
|
||||
//绑定操作事件
|
||||
function bindEvent(){
|
||||
//搜索处理
|
||||
$("#searchBtn").unbind().bind({
|
||||
click:function()
|
||||
{
|
||||
showAccountHeadDetails(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
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//重置按钮
|
||||
$("#searchResetBtn").unbind().bind({
|
||||
click:function(){
|
||||
$("#searchBillNo").val("");
|
||||
$("#searchBeginTime").val("");
|
||||
$("#searchEndTime").val("");
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
//保存信息
|
||||
$("#saveAccountHead").off("click").on("click", function () {
|
||||
if(!$('#accountHeadFM').form('validate')){
|
||||
return;
|
||||
} else {
|
||||
if (!$('#AccountId').val()) {
|
||||
$.messager.alert('提示', '请选择付款账户!', 'warning');
|
||||
return;
|
||||
}
|
||||
if (!$('#OrganId').combobox('getValue')) {
|
||||
$.messager.alert('提示', '请选择往来单位!', 'warning');
|
||||
return;
|
||||
}
|
||||
if (!$('#HandsPersonId').val()) {
|
||||
$.messager.alert('提示', '请选择经手人!', 'warning');
|
||||
return;
|
||||
}
|
||||
var OrganId = null;
|
||||
var ChangeAmount = $.trim($("#ChangeAmount").val());
|
||||
var TotalPrice = $("#accountHeadFM .datagrid-footer [field='EachAmount'] div").text();
|
||||
OrganId = $('#OrganId').combobox('getValue');
|
||||
//支出为负数
|
||||
ChangeAmount = 0 - ChangeAmount;
|
||||
//支出和付款为负数
|
||||
TotalPrice = 0 - TotalPrice;
|
||||
|
||||
saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId);
|
||||
}
|
||||
});
|
||||
|
||||
//打印单据
|
||||
$("#printAccountHeadShow").off("click").on("click",function(){
|
||||
var tableString = $("#accountHeadDlgShow").html();
|
||||
localStorage.setItem("tableString",tableString);
|
||||
window.open("../../js/print/print_form.html","location:No;status:No;help:No;dialogWidth:800px;dialogHeight:600px;scroll:auto;");
|
||||
});
|
||||
|
||||
//初始化键盘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=="BillNo"||obj.id=="BillTime"))
|
||||
{
|
||||
$("#saveAccountHead").click();
|
||||
}
|
||||
//搜索按钮添加快捷键
|
||||
if(k == "13"&&(obj.id=="searchBillNo"))
|
||||
{
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showAccountHeadDetails(pageNo,pageSize){
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/accountHead/list",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
search: JSON.stringify({
|
||||
type: listType,
|
||||
billNo: $.trim($("#searchBillNo").val()),
|
||||
beginTime: $("#searchBeginTime").val(),
|
||||
endTime: $("#searchEndTime").val()
|
||||
}),
|
||||
currentPage: pageNo,
|
||||
pageSize: pageSize
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200){
|
||||
if(res.data && res.data.page) {
|
||||
$("#tableData").datagrid('loadData', res.data.page);
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//自动计算事件
|
||||
function autoReckon() {
|
||||
//延时绑定事件
|
||||
setTimeout(function(){
|
||||
var body =$("#accountHeadFM .datagrid-body");
|
||||
var footer =$("#accountHeadFM .datagrid-footer");
|
||||
var input = ".datagrid-editable-input";
|
||||
|
||||
//修改金额,自动计算单价和合计
|
||||
body.find("[field='EachAmount']").find(input).off("keyup").on("keyup",function(){
|
||||
var TotalPrice = 0;
|
||||
var EachAmount =$(this).val()-0; //金额
|
||||
body.find("[field='EachAmount']").each(function(){
|
||||
if($(this).find("div").text()!==""){
|
||||
TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString());
|
||||
}
|
||||
});
|
||||
TotalPrice = TotalPrice + EachAmount;
|
||||
footer.find("[field='EachAmount']").find("div").text((TotalPrice).toFixed(2));
|
||||
});
|
||||
},500);
|
||||
}
|
||||
|
||||
//结束编辑
|
||||
function endEditing() {
|
||||
var edField = "";
|
||||
if(!itemType){
|
||||
edField = "InOutItemId";
|
||||
edName = "InOutItemName";
|
||||
}
|
||||
else {
|
||||
edField = "AccountId";
|
||||
edName = "AccountName";
|
||||
}
|
||||
if (editIndex == undefined) { return true }
|
||||
if ($('#accountData').datagrid('validateRow', editIndex)) {
|
||||
var ed = $('#accountData').datagrid('getEditor', {index: editIndex, field: edField});
|
||||
var textName =null;
|
||||
if($(ed.target)){
|
||||
textName = $(ed.target).combobox('getText');
|
||||
}
|
||||
$('#accountData').datagrid('getRows')[editIndex][edName] = textName;
|
||||
$('#accountData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//单击
|
||||
function onClickRow(index) {
|
||||
if (editIndex != index) {
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('selectRow', index)
|
||||
.datagrid('beginEdit', index);
|
||||
editIndex = index;
|
||||
autoReckon();
|
||||
} else {
|
||||
$('#accountData').datagrid('selectRow', editIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
//新增
|
||||
function append() {
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('appendRow', {});
|
||||
editIndex = $('#accountData').datagrid('getRows').length - 1;
|
||||
$('#accountData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
||||
autoReckon();
|
||||
}
|
||||
}
|
||||
//删除
|
||||
function removeit() {
|
||||
if (editIndex == undefined) { return }
|
||||
$('#accountData').datagrid('cancelEdit', editIndex)
|
||||
.datagrid('deleteRow', editIndex);
|
||||
editIndex = undefined;
|
||||
}
|
||||
//撤销
|
||||
function reject() {
|
||||
$('#accountData').datagrid('rejectChanges');
|
||||
editIndex = undefined;
|
||||
}
|
||||
//判断
|
||||
function CheckData() {
|
||||
var row = $('#accountData').datagrid('getRows');
|
||||
var totalRowNum = "";
|
||||
for (var i = 0; i < row.length; i++) {
|
||||
if(!itemType){
|
||||
if (row[i].InOutItemId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (row[i].AccountId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (totalRowNum != "") {
|
||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
||||
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
|
||||
if (editIndex != undefined) {
|
||||
$('#accountData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
}
|
||||
if (!CheckData())
|
||||
return false;
|
||||
var inserted = $("#accountData").datagrid('getChanges', "inserted");
|
||||
var deleted = $("#accountData").datagrid('getChanges', "deleted");
|
||||
var updated = $("#accountData").datagrid('getChanges', "updated");
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: {
|
||||
inserted: JSON.stringify(inserted),
|
||||
deleted: JSON.stringify(deleted),
|
||||
updated: JSON.stringify(updated),
|
||||
info : JSON.stringify({
|
||||
Type: listType,
|
||||
BillNo: $.trim($("#BillNo").val()),
|
||||
BillTime: $.trim($("#BillTime").val()),
|
||||
AccountId: $.trim($("#AccountId").val()),
|
||||
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付
|
||||
TotalPrice: TotalPrice, //合计
|
||||
OrganId: OrganId,
|
||||
HandsPersonId: $.trim($("#HandsPersonId").val()),
|
||||
Remark: $.trim($("#Remark").val())
|
||||
}),
|
||||
listType: listType
|
||||
},
|
||||
success: function (tipInfo)
|
||||
{
|
||||
if (tipInfo) {
|
||||
$.messager.alert('提示','保存成功!','info');
|
||||
$('#accountHeadDlg').dialog('close');
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showAccountHeadDetails(opts.pageNumber, opts.pageSize);
|
||||
}
|
||||
else{
|
||||
|
||||
$.messager.show({
|
||||
title: '错误提示',
|
||||
msg: '保存信息失败,请稍后重试!'
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XmlHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,868 +0,0 @@
|
||||
//初始化界面
|
||||
var listTitle ="收款单列表";
|
||||
var listType = "收款";
|
||||
var itemType = true; //隐藏当前列
|
||||
var moneyType = false; //显示当前列
|
||||
var payTypeTitle = "无标题";
|
||||
var inOrOut = "";
|
||||
var organUrl = "/supplier/findBySelect_cus"; //客户接口
|
||||
var amountNum = "SK";
|
||||
$(function(){
|
||||
initSystemData_person(); //经手人数据
|
||||
initSelectInfo_person(); //经手人信息
|
||||
initSystemData_account(); //账户数据
|
||||
initSelectInfo_account(); //账户信息
|
||||
initSupplier(); //供应商
|
||||
initTableData();
|
||||
ininPager();
|
||||
initForm();
|
||||
bindEvent();//绑定操作事件
|
||||
$("#searchBtn").click();
|
||||
});
|
||||
//获取账户信息
|
||||
function initSystemData_account(){
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/account/getAccount",
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
if(res.data) {
|
||||
accountList = res.data.accountList;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取账户信息
|
||||
function initSelectInfo_account(){
|
||||
var options = "";
|
||||
if(accountList !=null)
|
||||
{
|
||||
options = "";
|
||||
for(var i = 0 ;i < accountList.length; i++)
|
||||
{
|
||||
var account = accountList[i];
|
||||
options += '<option value="' + account.id + '">' + account.name + '</option>';
|
||||
}
|
||||
$("#AccountId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//初始化单位信息
|
||||
function initSupplier(){
|
||||
$('#OrganId').combobox({
|
||||
url: organUrl,
|
||||
valueField:'id',
|
||||
textField:'supplier',
|
||||
formatter: function(row){
|
||||
var opts = $(this).combobox('options');
|
||||
if(row[opts.textField]!=="非会员") {
|
||||
return row[opts.textField];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//获取财务员
|
||||
function initSystemData_person(){
|
||||
var type = "财务员";
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/person/getPersonByType",
|
||||
data: {
|
||||
type: type
|
||||
},
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
personList = res.data.personList;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取财务员
|
||||
function initSelectInfo_person(){
|
||||
var options = "";
|
||||
|
||||
if(personList !=null)
|
||||
{
|
||||
for(var i = 0 ;i < personList.length;i++)
|
||||
{
|
||||
var person = personList[i];
|
||||
if(0 == i)
|
||||
{
|
||||
personID = person.id;
|
||||
}
|
||||
if(person.type=="财务员")
|
||||
{
|
||||
options += '<option value="' + person.id + '">' + person.name + '</option>';
|
||||
}
|
||||
}
|
||||
$("#HandsPersonId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//防止表单提交重复
|
||||
function initForm(){
|
||||
$('#accountHeadFM').form({
|
||||
onSubmit: function(){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据
|
||||
function initTableData(){
|
||||
var organNameTitle ="付款单位";
|
||||
var organNameHidden = false;
|
||||
$('#tableData').datagrid({
|
||||
//width:700,
|
||||
height:heightInfo,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: 5,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
||||
{ title: '操作',field: 'op',align:"center",width:90,formatter:function(value, rec,index) {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/7 10:48
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js
|
||||
*/
|
||||
var str = '';
|
||||
var orgId = rec.organid ? rec.organid : 0;
|
||||
str += '<img title="查看" src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccountHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.id +',' + orgId +',' + rec.totalprice + ');"/>';
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{ field: 'organid',width:5, hidden:true},
|
||||
{ title: organNameTitle,field: 'organname',width:140,hidden:organNameHidden},
|
||||
{ title: '单据编号',field: 'billno',width:140},
|
||||
{ title: '经手人',field: 'handspersonname',width:80},
|
||||
{ title: '单据时间 ',field: 'billtime',width:140},
|
||||
{ title: '合计',field: 'totalprice',width:80},
|
||||
{ title: '备注',field: 'remark',width:100}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'addAccountHead',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function()
|
||||
{
|
||||
addAccountHead();
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'deleteAccountHead',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function()
|
||||
{
|
||||
batDeleteAccountHead();
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据-明细列表-编辑状态
|
||||
function initTableData_account(type,TotalPrice){
|
||||
$('#accountData').datagrid({
|
||||
height:280,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: payTypeTitle,field: 'InOutItemId',width:230,hidden:itemType,
|
||||
formatter:function(value,row,index){
|
||||
return row.InOutItemName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'InOutItemName',
|
||||
method:'get',
|
||||
url: "/inOutItem/findBySelect?type=" + inOrOut
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '账户名称',field: 'AccountId',width:230,hidden:moneyType,
|
||||
formatter:function(value,row,index){
|
||||
return row.AccountName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'AccountName',
|
||||
method:'get',
|
||||
url: "/account/findBySelect"
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '金额',field: 'EachAmount',editor:'validatebox',width:70},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:150}
|
||||
]],
|
||||
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;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/accountItem/getDetailList',
|
||||
data: {
|
||||
headerId: accountHeadID
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var EachAmount = 0;
|
||||
if(type === "edit") {
|
||||
EachAmount = TotalPrice;
|
||||
}
|
||||
var array = [];
|
||||
array.push({
|
||||
"EachAmount": EachAmount
|
||||
});
|
||||
data.footer = array;
|
||||
$("#accountData").datagrid('loadData',data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//初始化表格数据-明细列表-查看状态
|
||||
function initTableData_account_show(TotalPrice){
|
||||
$('#accountDataShow').datagrid({
|
||||
height:280,
|
||||
rownumbers: true,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ title: payTypeTitle, field: 'InOutItemName', width:230, hidden:itemType},
|
||||
{ title: '账户名称', field: 'AccountName', width:230, hidden:moneyType},
|
||||
{ title: '金额',field: 'EachAmount',width:70},
|
||||
{ title: '备注',field: 'Remark',width:150}
|
||||
]],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/accountItem/getDetailList',
|
||||
data: {
|
||||
headerId: accountHeadID
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var EachAmount = TotalPrice;
|
||||
var array = [];
|
||||
array.push({
|
||||
"EachAmount": EachAmount
|
||||
});
|
||||
data.footer = array;
|
||||
$("#accountDataShow").datagrid('loadData', data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//分页信息处理
|
||||
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
|
||||
});
|
||||
showAccountHeadDetails(pageNum,pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
||||
}
|
||||
}
|
||||
|
||||
//删除财务信息
|
||||
function deleteAccountHead(accountHeadID, thisOrganId, totalPrice){
|
||||
$.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r)
|
||||
{
|
||||
if (r)
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
||||
dataType: "json",
|
||||
data:{
|
||||
ids: accountHeadID
|
||||
},
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=accountHeadID;
|
||||
jsondata.deleteType='2';
|
||||
var type='single';
|
||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量删除财务信息
|
||||
function batDeleteAccountHead(){
|
||||
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;
|
||||
}
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
|
||||
//批量删除
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
ids : ids
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked", false);
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=ids;
|
||||
jsondata.deleteType='2';
|
||||
var type='batch';
|
||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 确认强制删除
|
||||
* */
|
||||
function batDeleteAccountHeadForceConfirm(res,url,jsondata) {
|
||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: (jsondata),
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
if(type=='batch'){
|
||||
$(":checkbox").attr("checked", false);
|
||||
}
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//增加
|
||||
function addAccountHead(){
|
||||
$('#accountHeadFM').form('clear');
|
||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||
$("#BillTime").val(thisDateTime);
|
||||
var thisNumber = getNowFormatDateNum(); //根据时间生成编号
|
||||
$("#BillNo").val(amountNum + thisNumber).focus();
|
||||
var addTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加' + addTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
orgAccountHead = "";
|
||||
accountHeadID = 0;
|
||||
initTableData_account("add"); //明细列表
|
||||
reject(); //撤销下、刷新材料列表
|
||||
url = '/accountHead/addAccountHeadAndDetail';
|
||||
|
||||
}
|
||||
|
||||
//编辑信息
|
||||
function editAccountHead(index){
|
||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#BillNo").val(rowsdata.billno);
|
||||
$("#BillTime").val(rowsdata.billtime);
|
||||
$("#Remark").val(rowsdata.remark);
|
||||
$("#AccountId").val(rowsdata.accountid);
|
||||
$('#OrganId').combobox('setValue', rowsdata.organid);
|
||||
$("#HandsPersonId").val(rowsdata.handspersonid);
|
||||
$("#ChangeAmount").val(rowsdata.changeamount);
|
||||
var TotalPrice = rowsdata.totalprice;
|
||||
preTotalPrice = rowsdata.totalprice; //记录前一次合计金额,用于收预付款
|
||||
var editTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + '/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑' + editTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
accountHeadID = rowsdata.id;
|
||||
|
||||
initTableData_account("edit",TotalPrice); //明细列表
|
||||
reject(); //撤销下、刷新列表
|
||||
url = '/accountHead/updateAccountHeadAndDetail?id=' + rowsdata.id;
|
||||
}
|
||||
|
||||
//查看信息
|
||||
function showAccountHead(index){
|
||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#BillNoShow").text(rowsdata.billno);
|
||||
$("#BillTimeShow").text(rowsdata.billtime);
|
||||
$("#RemarkShow").text(rowsdata.remark);
|
||||
$("#AccountIdShow").text(rowsdata.accountname);
|
||||
$('#OrganIdShow').text(rowsdata.organname);
|
||||
$("#HandsPersonIdShow").text(rowsdata.handspersonname);
|
||||
$("#ChangeAmountShow").text(rowsdata.rowsdata==undefined?'0':rowsdata.rowsdata);
|
||||
var TotalPrice = rowsdata.totalprice;
|
||||
var showTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/list.png"/> 查看' + showTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
accountHeadID = rowsdata.id;
|
||||
initTableData_account_show(TotalPrice); //明细列表-查看状态
|
||||
}
|
||||
|
||||
//绑定操作事件
|
||||
function bindEvent(){
|
||||
//搜索处理
|
||||
$("#searchBtn").unbind().bind({
|
||||
click:function()
|
||||
{
|
||||
showAccountHeadDetails(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
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//重置按钮
|
||||
$("#searchResetBtn").unbind().bind({
|
||||
click:function(){
|
||||
$("#searchBillNo").val("");
|
||||
$("#searchBeginTime").val("");
|
||||
$("#searchEndTime").val("");
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
//保存信息
|
||||
$("#saveAccountHead").off("click").on("click", function () {
|
||||
if(!$('#accountHeadFM').form('validate')){
|
||||
return;
|
||||
} else {
|
||||
if (!$('#OrganId').combobox('getValue')) {
|
||||
$.messager.alert('提示', '请选择付款单位!', 'warning');
|
||||
return;
|
||||
}
|
||||
if (!$('#HandsPersonId').val()) {
|
||||
$.messager.alert('提示', '请选择经手人!', 'warning');
|
||||
return;
|
||||
}
|
||||
var OrganId = null;
|
||||
var ChangeAmount = $.trim($("#ChangeAmount").val());
|
||||
var TotalPrice = $("#accountHeadFM .datagrid-footer [field='EachAmount'] div").text();
|
||||
OrganId = $('#OrganId').combobox('getValue');
|
||||
saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId);
|
||||
}
|
||||
});
|
||||
|
||||
//打印单据
|
||||
$("#printAccountHeadShow").off("click").on("click",function(){
|
||||
var tableString = $("#accountHeadDlgShow").html();
|
||||
localStorage.setItem("tableString",tableString);
|
||||
window.open("../../js/print/print_form.html","location:No;status:No;help:No;dialogWidth:800px;dialogHeight:600px;scroll:auto;");
|
||||
});
|
||||
|
||||
//初始化键盘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=="BillNo"||obj.id=="BillTime"))
|
||||
{
|
||||
$("#saveAccountHead").click();
|
||||
}
|
||||
//搜索按钮添加快捷键
|
||||
if(k == "13"&&(obj.id=="searchBillNo"))
|
||||
{
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showAccountHeadDetails(pageNo,pageSize){
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/accountHead/list",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
search: JSON.stringify({
|
||||
type: listType,
|
||||
billNo: $.trim($("#searchBillNo").val()),
|
||||
beginTime: $("#searchBeginTime").val(),
|
||||
endTime: $("#searchEndTime").val()
|
||||
}),
|
||||
currentPage: pageNo,
|
||||
pageSize: pageSize
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200){
|
||||
if(res.data && res.data.page) {
|
||||
$("#tableData").datagrid('loadData', res.data.page);
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//自动计算事件
|
||||
function autoReckon() {
|
||||
//延时绑定事件
|
||||
setTimeout(function(){
|
||||
var body =$("#accountHeadFM .datagrid-body");
|
||||
var footer =$("#accountHeadFM .datagrid-footer");
|
||||
var input = ".datagrid-editable-input";
|
||||
|
||||
//修改金额,自动计算单价和合计
|
||||
body.find("[field='EachAmount']").find(input).off("keyup").on("keyup",function(){
|
||||
var TotalPrice = 0;
|
||||
var EachAmount =$(this).val()-0; //金额
|
||||
body.find("[field='EachAmount']").each(function(){
|
||||
if($(this).find("div").text()!==""){
|
||||
TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString());
|
||||
}
|
||||
});
|
||||
TotalPrice = TotalPrice + EachAmount;
|
||||
footer.find("[field='EachAmount']").find("div").text((TotalPrice).toFixed(2));
|
||||
});
|
||||
},500);
|
||||
}
|
||||
|
||||
//结束编辑
|
||||
function endEditing() {
|
||||
var edField = "";
|
||||
if(!itemType){
|
||||
edField = "InOutItemId";
|
||||
edName = "InOutItemName";
|
||||
}
|
||||
else {
|
||||
edField = "AccountId";
|
||||
edName = "AccountName";
|
||||
}
|
||||
if (editIndex == undefined) { return true }
|
||||
if ($('#accountData').datagrid('validateRow', editIndex)) {
|
||||
var ed = $('#accountData').datagrid('getEditor', {index: editIndex, field: edField});
|
||||
var textName =null;
|
||||
if($(ed.target)){
|
||||
textName = $(ed.target).combobox('getText');
|
||||
}
|
||||
$('#accountData').datagrid('getRows')[editIndex][edName] = textName;
|
||||
$('#accountData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//单击
|
||||
function onClickRow(index) {
|
||||
if (editIndex != index) {
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('selectRow', index)
|
||||
.datagrid('beginEdit', index);
|
||||
editIndex = index;
|
||||
autoReckon();
|
||||
} else {
|
||||
$('#accountData').datagrid('selectRow', editIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
//新增
|
||||
function append() {
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('appendRow', {});
|
||||
editIndex = $('#accountData').datagrid('getRows').length - 1;
|
||||
$('#accountData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
||||
autoReckon();
|
||||
}
|
||||
}
|
||||
//删除
|
||||
function removeit() {
|
||||
if (editIndex == undefined) { return }
|
||||
$('#accountData').datagrid('cancelEdit', editIndex)
|
||||
.datagrid('deleteRow', editIndex);
|
||||
editIndex = undefined;
|
||||
}
|
||||
//撤销
|
||||
function reject() {
|
||||
$('#accountData').datagrid('rejectChanges');
|
||||
editIndex = undefined;
|
||||
}
|
||||
//判断
|
||||
function CheckData() {
|
||||
var row = $('#accountData').datagrid('getRows');
|
||||
var totalRowNum = "";
|
||||
for (var i = 0; i < row.length; i++) {
|
||||
if(!itemType){
|
||||
if (row[i].InOutItemId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (row[i].AccountId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (totalRowNum != "") {
|
||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
||||
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
|
||||
if (editIndex != undefined) {
|
||||
$('#accountData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
}
|
||||
if (!CheckData())
|
||||
return false;
|
||||
var inserted = $("#accountData").datagrid('getChanges', "inserted");
|
||||
var deleted = $("#accountData").datagrid('getChanges', "deleted");
|
||||
var updated = $("#accountData").datagrid('getChanges', "updated");
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: {
|
||||
inserted: JSON.stringify(inserted),
|
||||
deleted: JSON.stringify(deleted),
|
||||
updated: JSON.stringify(updated),
|
||||
info : JSON.stringify({
|
||||
Type: listType,
|
||||
BillNo: $.trim($("#BillNo").val()),
|
||||
BillTime: $.trim($("#BillTime").val()),
|
||||
AccountId: $.trim($("#AccountId").val()),
|
||||
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付
|
||||
TotalPrice: TotalPrice, //合计
|
||||
OrganId: OrganId,
|
||||
HandsPersonId: $.trim($("#HandsPersonId").val()),
|
||||
Remark: $.trim($("#Remark").val())
|
||||
}),
|
||||
listType: listType
|
||||
},
|
||||
success: function (tipInfo)
|
||||
{
|
||||
if (tipInfo) {
|
||||
$.messager.alert('提示','保存成功!','info');
|
||||
$('#accountHeadDlg').dialog('close');
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showAccountHeadDetails(opts.pageNumber, opts.pageSize);
|
||||
}
|
||||
else{
|
||||
|
||||
$.messager.show({
|
||||
title: '错误提示',
|
||||
msg: '保存信息失败,请稍后重试!'
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XmlHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,890 +0,0 @@
|
||||
//初始化界面
|
||||
var listTitle ="付款单列表";
|
||||
var listType = "付款";
|
||||
var itemType = true; //隐藏当前列
|
||||
var moneyType = false; //显示当前列
|
||||
var payTypeTitle = "无标题";
|
||||
var inOrOut = "";
|
||||
var organUrl = "/supplier/findBySelect_sup"; //供应商接口
|
||||
var amountNum = "FK";
|
||||
$(function(){
|
||||
initSystemData_person(); //经手人数据
|
||||
initSelectInfo_person(); //经手人信息
|
||||
initSystemData_account(); //账户数据
|
||||
initSelectInfo_account(); //账户信息
|
||||
initSupplier(); //供应商
|
||||
initTableData();
|
||||
ininPager();
|
||||
initForm();
|
||||
bindEvent();//绑定操作事件
|
||||
$("#searchBtn").click();
|
||||
});
|
||||
//获取账户信息
|
||||
function initSystemData_account(){
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/account/getAccount",
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
if(res.data) {
|
||||
accountList = res.data.accountList;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取账户信息
|
||||
function initSelectInfo_account(){
|
||||
var options = "";
|
||||
if(accountList !=null)
|
||||
{
|
||||
options = "";
|
||||
for(var i = 0 ;i < accountList.length; i++)
|
||||
{
|
||||
var account = accountList[i];
|
||||
options += '<option value="' + account.id + '">' + account.name + '</option>';
|
||||
}
|
||||
$("#AccountId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//初始化单位信息
|
||||
function initSupplier(){
|
||||
$('#OrganId').combobox({
|
||||
url: organUrl,
|
||||
valueField:'id',
|
||||
textField:'supplier',
|
||||
formatter: function(row){
|
||||
var opts = $(this).combobox('options');
|
||||
if(row[opts.textField]!=="非会员") {
|
||||
return row[opts.textField];
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//获取财务员
|
||||
function initSystemData_person(){
|
||||
var type = "财务员";
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/person/getPersonByType",
|
||||
data: {
|
||||
type: type
|
||||
},
|
||||
//设置为同步
|
||||
async:false,
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
personList = res.data.personList;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
//获取财务员
|
||||
function initSelectInfo_person(){
|
||||
var options = "";
|
||||
|
||||
if(personList !=null)
|
||||
{
|
||||
for(var i = 0 ;i < personList.length;i++)
|
||||
{
|
||||
var person = personList[i];
|
||||
if(0 == i)
|
||||
{
|
||||
personID = person.id;
|
||||
}
|
||||
if(person.type=="财务员")
|
||||
{
|
||||
options += '<option value="' + person.id + '">' + person.name + '</option>';
|
||||
}
|
||||
}
|
||||
$("#HandsPersonId").empty().append(options);
|
||||
}
|
||||
}
|
||||
|
||||
//防止表单提交重复
|
||||
function initForm(){
|
||||
$('#accountHeadFM').form({
|
||||
onSubmit: function(){
|
||||
return false;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据
|
||||
function initTableData(){
|
||||
var organNameTitle = "收款单位";
|
||||
var organNameHidden = false;
|
||||
$('#tableData').datagrid({
|
||||
//width:700,
|
||||
height:heightInfo,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: 5,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
||||
{ title: '操作',field: 'op',align:"center",width:90,formatter:function(value, rec,index) {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/7 10:48
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js
|
||||
*/
|
||||
var str = '';
|
||||
var orgId = rec.organid ? rec.organid : 0;
|
||||
str += '<img title="查看" src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccountHead(\'' + index + '\');"/> ';
|
||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccountHead('+ rec.id +',' + orgId +',' + rec.totalprice + ');"/>';
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{ field: 'organid',width:5, hidden:true},
|
||||
{ title: organNameTitle,field: 'organname',width:140,hidden:organNameHidden},
|
||||
{ title: '单据编号',field: 'billno',width:140},
|
||||
{ title: '经手人',field: 'handspersonname',width:80},
|
||||
{ title: '单据时间 ',field: 'billtime',width:140},
|
||||
{ title: '合计',field: 'totalprice',width:80},
|
||||
{ title: '备注',field: 'remark',width:100}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'addAccountHead',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function()
|
||||
{
|
||||
addAccountHead();
|
||||
}
|
||||
},
|
||||
{
|
||||
id:'deleteAccountHead',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function()
|
||||
{
|
||||
batDeleteAccountHead();
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//初始化表格数据-明细列表-编辑状态
|
||||
function initTableData_account(type,TotalPrice){
|
||||
$('#accountData').datagrid({
|
||||
height:280,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ field: 'Id',width:35,align:"center",checkbox:true},
|
||||
{ title: payTypeTitle,field: 'InOutItemId',width:230,hidden:itemType,
|
||||
formatter:function(value,row,index){
|
||||
return row.InOutItemName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'InOutItemName',
|
||||
method:'get',
|
||||
url: "/inOutItem/findBySelect?type=" + inOrOut
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '账户名称',field: 'AccountId',width:230,hidden:moneyType,
|
||||
formatter:function(value,row,index){
|
||||
return row.AccountName;
|
||||
},
|
||||
editor:{
|
||||
type:'combobox',
|
||||
options:{
|
||||
valueField:'Id',
|
||||
textField:'AccountName',
|
||||
method:'get',
|
||||
url: "/account/findBySelect"
|
||||
}
|
||||
}
|
||||
},
|
||||
{ title: '金额',field: 'EachAmount',editor:'validatebox',width:70},
|
||||
{ title: '备注',field: 'Remark',editor:'validatebox',width:150}
|
||||
]],
|
||||
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;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/accountItem/getDetailList',
|
||||
data: {
|
||||
headerId: accountHeadID
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var EachAmount = 0;
|
||||
if(type === "edit") {
|
||||
EachAmount = TotalPrice;
|
||||
}
|
||||
var array = [];
|
||||
array.push({
|
||||
"EachAmount": EachAmount
|
||||
});
|
||||
data.footer = array;
|
||||
$("#accountData").datagrid('loadData',data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//初始化表格数据-明细列表-查看状态
|
||||
function initTableData_account_show(TotalPrice){
|
||||
$('#accountDataShow').datagrid({
|
||||
height:280,
|
||||
rownumbers: true,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
pagination: false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
showFooter: true,
|
||||
//loadFilter: pagerFilter,
|
||||
onClickRow: onClickRow,
|
||||
columns:[[
|
||||
{ title: payTypeTitle, field: 'InOutItemName', width:230, hidden:itemType},
|
||||
{ title: '账户名称', field: 'AccountName', width:230, hidden:moneyType},
|
||||
{ title: '金额',field: 'EachAmount',width:70},
|
||||
{ title: '备注',field: 'Remark',width:150}
|
||||
]],
|
||||
onLoadError:function()
|
||||
{
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: '/accountItem/getDetailList',
|
||||
data: {
|
||||
headerId: accountHeadID
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
var data = res.data;
|
||||
var EachAmount = TotalPrice;
|
||||
var array = [];
|
||||
array.push({
|
||||
"EachAmount": EachAmount
|
||||
});
|
||||
data.footer = array;
|
||||
$("#accountDataShow").datagrid('loadData', data);
|
||||
}
|
||||
},
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//分页信息处理
|
||||
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
|
||||
});
|
||||
showAccountHeadDetails(pageNum,pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e)
|
||||
{
|
||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
||||
}
|
||||
}
|
||||
|
||||
//删除财务信息
|
||||
function deleteAccountHead(accountHeadID, thisOrganId, totalPrice){
|
||||
$.messager.confirm('删除确认','确定要删除此财务信息吗?',function(r)
|
||||
{
|
||||
if (r)
|
||||
{
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
||||
dataType: "json",
|
||||
data:{
|
||||
ids: accountHeadID
|
||||
},
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=accountHeadID;
|
||||
jsondata.deleteType='2';
|
||||
var type='single';
|
||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量删除财务信息
|
||||
function batDeleteAccountHead(){
|
||||
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;
|
||||
}
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
|
||||
//批量删除
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/accountHead/batchDeleteAccountHeadByIds",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
ids : ids
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked", false);
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=ids;
|
||||
jsondata.deleteType='2';
|
||||
var type='batch';
|
||||
batDeleteAccountHeadForceConfirm(res,"/accountHead/batchDeleteAccountHeadByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 确认强制删除
|
||||
* */
|
||||
function batDeleteAccountHeadForceConfirm(res,url,jsondata) {
|
||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: (jsondata),
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
if(type=='batch'){
|
||||
$(":checkbox").attr("checked", false);
|
||||
}
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
return;
|
||||
}else {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('删除提示','删除财务信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//增加
|
||||
function addAccountHead(){
|
||||
$('#accountHeadFM').form('clear');
|
||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||
$("#BillTime").val(thisDateTime);
|
||||
var thisNumber = getNowFormatDateNum(); //根据时间生成编号
|
||||
$("#BillNo").val(amountNum + thisNumber).focus();
|
||||
var addTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加' + addTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
orgAccountHead = "";
|
||||
accountHeadID = 0;
|
||||
initTableData_account("add"); //明细列表
|
||||
reject(); //撤销下、刷新材料列表
|
||||
url = '/accountHead/addAccountHeadAndDetail';
|
||||
|
||||
//收预付款单据支持刷卡功能
|
||||
if(listType == "收预付款") {
|
||||
//当会员卡号长度超过10位后,自动点击下拉框,用于兼容刷卡器
|
||||
$("#OrganId").next().find("input").off("keyup").on("keyup",function(){
|
||||
if($(this).val().length === 10){
|
||||
setTimeout(function(){
|
||||
$(".combo-panel .combobox-item-selected").click();
|
||||
},500);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//编辑信息
|
||||
function editAccountHead(index){
|
||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#BillNo").val(rowsdata.billno);
|
||||
$("#BillTime").val(rowsdata.billtime);
|
||||
$("#Remark").val(rowsdata.remark);
|
||||
$("#AccountId").val(rowsdata.accountid);
|
||||
$('#OrganId').combobox('setValue', rowsdata.organid);
|
||||
$("#HandsPersonId").val(rowsdata.handspersonid);
|
||||
$("#ChangeAmount").val(rowsdata.changeamount);
|
||||
var TotalPrice = rowsdata.totalprice;
|
||||
preTotalPrice = rowsdata.totalprice; //记录前一次合计金额,用于收预付款
|
||||
var editTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlg').dialog('open').dialog('setTitle','<img src="' + '/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑' + editTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
accountHeadID = rowsdata.id;
|
||||
|
||||
initTableData_account("edit",TotalPrice); //明细列表
|
||||
reject(); //撤销下、刷新列表
|
||||
url = '/accountHead/updateAccountHeadAndDetail?id=' + rowsdata.id;
|
||||
}
|
||||
|
||||
//查看信息
|
||||
function showAccountHead(index){
|
||||
// var accountHeadInfo = accountHeadTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#BillNoShow").text(rowsdata.billno);
|
||||
$("#BillTimeShow").text(rowsdata.billtime);
|
||||
$("#RemarkShow").text(rowsdata.remark);
|
||||
$("#AccountIdShow").text(rowsdata.accountname);
|
||||
$('#OrganIdShow').text(rowsdata.organname);
|
||||
$("#HandsPersonIdShow").text(rowsdata.handspersonname);
|
||||
$("#ChangeAmountShow").text(rowsdata.rowsdata==undefined?'0':rowsdata.rowsdata);
|
||||
var TotalPrice = rowsdata.totalprice;
|
||||
var showTitle = listTitle.replace("列表","信息");
|
||||
$('#accountHeadDlgShow').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/list.png"/> 查看' + showTitle);
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
|
||||
accountHeadID = rowsdata.id;
|
||||
initTableData_account_show(TotalPrice); //明细列表-查看状态
|
||||
}
|
||||
|
||||
//绑定操作事件
|
||||
function bindEvent(){
|
||||
//搜索处理
|
||||
$("#searchBtn").unbind().bind({
|
||||
click:function()
|
||||
{
|
||||
showAccountHeadDetails(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
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
//重置按钮
|
||||
$("#searchResetBtn").unbind().bind({
|
||||
click:function(){
|
||||
$("#searchBillNo").val("");
|
||||
$("#searchBeginTime").val("");
|
||||
$("#searchEndTime").val("");
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
//保存信息
|
||||
$("#saveAccountHead").off("click").on("click", function () {
|
||||
if(!$('#accountHeadFM').form('validate')){
|
||||
return;
|
||||
} else {
|
||||
if (!$('#OrganId').combobox('getValue')) {
|
||||
$.messager.alert('提示', '请选择收款单位!', 'warning');
|
||||
return;
|
||||
}
|
||||
if (!$('#HandsPersonId').val()) {
|
||||
$.messager.alert('提示', '请选择经手人!', 'warning');
|
||||
return;
|
||||
}
|
||||
var OrganId = null;
|
||||
var ChangeAmount = $.trim($("#ChangeAmount").val());
|
||||
var TotalPrice = $("#accountHeadFM .datagrid-footer [field='EachAmount'] div").text();
|
||||
if (listType !== "转账") {
|
||||
OrganId = $('#OrganId').combobox('getValue');
|
||||
}
|
||||
if (listType === "支出" || listType === "转账") {
|
||||
//支出为负数
|
||||
ChangeAmount = 0 - ChangeAmount;
|
||||
}
|
||||
if (listType === "支出" || listType === "付款" || listType === "转账") {
|
||||
//支出和付款为负数
|
||||
TotalPrice = 0 - TotalPrice;
|
||||
}
|
||||
|
||||
saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId);
|
||||
}
|
||||
});
|
||||
|
||||
//打印单据
|
||||
$("#printAccountHeadShow").off("click").on("click",function(){
|
||||
var tableString = $("#accountHeadDlgShow").html();
|
||||
localStorage.setItem("tableString",tableString);
|
||||
window.open("../../js/print/print_form.html","location:No;status:No;help:No;dialogWidth:800px;dialogHeight:600px;scroll:auto;");
|
||||
});
|
||||
|
||||
//初始化键盘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=="BillNo"||obj.id=="BillTime"))
|
||||
{
|
||||
$("#saveAccountHead").click();
|
||||
}
|
||||
//搜索按钮添加快捷键
|
||||
if(k == "13"&&(obj.id=="searchBillNo"))
|
||||
{
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function showAccountHeadDetails(pageNo,pageSize){
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/accountHead/list",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
search: JSON.stringify({
|
||||
type: listType,
|
||||
billNo: $.trim($("#searchBillNo").val()),
|
||||
beginTime: $("#searchBeginTime").val(),
|
||||
endTime: $("#searchEndTime").val()
|
||||
}),
|
||||
currentPage: pageNo,
|
||||
pageSize: pageSize
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200){
|
||||
if(res.data && res.data.page) {
|
||||
$("#tableData").datagrid('loadData', res.data.page);
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//自动计算事件
|
||||
function autoReckon() {
|
||||
//延时绑定事件
|
||||
setTimeout(function(){
|
||||
var body =$("#accountHeadFM .datagrid-body");
|
||||
var footer =$("#accountHeadFM .datagrid-footer");
|
||||
var input = ".datagrid-editable-input";
|
||||
|
||||
//修改金额,自动计算单价和合计
|
||||
body.find("[field='EachAmount']").find(input).off("keyup").on("keyup",function(){
|
||||
var TotalPrice = 0;
|
||||
var EachAmount =$(this).val()-0; //金额
|
||||
body.find("[field='EachAmount']").each(function(){
|
||||
if($(this).find("div").text()!==""){
|
||||
TotalPrice = TotalPrice + parseFloat($(this).find("div").text().toString());
|
||||
}
|
||||
});
|
||||
TotalPrice = TotalPrice + EachAmount;
|
||||
footer.find("[field='EachAmount']").find("div").text((TotalPrice).toFixed(2));
|
||||
});
|
||||
},500);
|
||||
}
|
||||
|
||||
//结束编辑
|
||||
function endEditing() {
|
||||
var edField = "";
|
||||
if(!itemType){
|
||||
edField = "InOutItemId";
|
||||
edName = "InOutItemName";
|
||||
}
|
||||
else {
|
||||
edField = "AccountId";
|
||||
edName = "AccountName";
|
||||
}
|
||||
if (editIndex == undefined) { return true }
|
||||
if ($('#accountData').datagrid('validateRow', editIndex)) {
|
||||
var ed = $('#accountData').datagrid('getEditor', {index: editIndex, field: edField});
|
||||
var textName =null;
|
||||
if($(ed.target)){
|
||||
textName = $(ed.target).combobox('getText');
|
||||
}
|
||||
$('#accountData').datagrid('getRows')[editIndex][edName] = textName;
|
||||
$('#accountData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
return true;
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
//单击
|
||||
function onClickRow(index) {
|
||||
if (editIndex != index) {
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('selectRow', index)
|
||||
.datagrid('beginEdit', index);
|
||||
editIndex = index;
|
||||
autoReckon();
|
||||
} else {
|
||||
$('#accountData').datagrid('selectRow', editIndex);
|
||||
}
|
||||
}
|
||||
}
|
||||
//新增
|
||||
function append() {
|
||||
if (endEditing()) {
|
||||
$('#accountData').datagrid('appendRow', {});
|
||||
editIndex = $('#accountData').datagrid('getRows').length - 1;
|
||||
$('#accountData').datagrid('selectRow', editIndex).datagrid('beginEdit', editIndex);
|
||||
autoReckon();
|
||||
}
|
||||
}
|
||||
//删除
|
||||
function removeit() {
|
||||
if (editIndex == undefined) { return }
|
||||
$('#accountData').datagrid('cancelEdit', editIndex)
|
||||
.datagrid('deleteRow', editIndex);
|
||||
editIndex = undefined;
|
||||
}
|
||||
//撤销
|
||||
function reject() {
|
||||
$('#accountData').datagrid('rejectChanges');
|
||||
editIndex = undefined;
|
||||
}
|
||||
//判断
|
||||
function CheckData() {
|
||||
var row = $('#accountData').datagrid('getRows');
|
||||
var totalRowNum = "";
|
||||
for (var i = 0; i < row.length; i++) {
|
||||
if(!itemType){
|
||||
if (row[i].InOutItemId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
else{
|
||||
if (row[i].AccountId == "") {
|
||||
totalRowNum += (i + 1) + "、";
|
||||
}
|
||||
}
|
||||
}
|
||||
if (totalRowNum != "") {
|
||||
var totalRowNum = totalRowNum.substring(0, totalRowNum.length - 1);
|
||||
$.messager.alert('提示',"第" + totalRowNum + "行数据填写不完整!",'info');
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
function saveAccountHeadAndDetail(listType,ChangeAmount,TotalPrice,OrganId) {
|
||||
if (editIndex != undefined) {
|
||||
$('#accountData').datagrid('endEdit', editIndex);
|
||||
editIndex = undefined;
|
||||
}
|
||||
if (!CheckData())
|
||||
return false;
|
||||
var inserted = $("#accountData").datagrid('getChanges', "inserted");
|
||||
var deleted = $("#accountData").datagrid('getChanges', "deleted");
|
||||
var updated = $("#accountData").datagrid('getChanges', "updated");
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: {
|
||||
inserted: JSON.stringify(inserted),
|
||||
deleted: JSON.stringify(deleted),
|
||||
updated: JSON.stringify(updated),
|
||||
info : JSON.stringify({
|
||||
Type: listType,
|
||||
BillNo: $.trim($("#BillNo").val()),
|
||||
BillTime: $.trim($("#BillTime").val()),
|
||||
AccountId: $.trim($("#AccountId").val()),
|
||||
ChangeAmount: ChangeAmount, //付款/收款/优惠/实付
|
||||
TotalPrice: TotalPrice, //合计
|
||||
OrganId: OrganId,
|
||||
HandsPersonId: $.trim($("#HandsPersonId").val()),
|
||||
Remark: $.trim($("#Remark").val())
|
||||
}),
|
||||
listType: listType
|
||||
},
|
||||
success: function (tipInfo)
|
||||
{
|
||||
if (tipInfo) {
|
||||
$.messager.alert('提示','保存成功!','info');
|
||||
$('#accountHeadDlg').dialog('close');
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showAccountHeadDetails(opts.pageNumber, opts.pageSize);
|
||||
}
|
||||
else{
|
||||
|
||||
$.messager.show({
|
||||
title: '错误提示',
|
||||
msg: '保存信息失败,请稍后重试!'
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
error: function (XmlHttpRequest, textStatus, errorThrown)
|
||||
{
|
||||
$.messager.alert('提示',XmlHttpRequest.responseText,'error');
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -1,706 +0,0 @@
|
||||
var listType = "客户"; //类型
|
||||
var listTypeEn ="Customer"; //英文类型
|
||||
//初始化界面
|
||||
$(function() {
|
||||
initTableData();
|
||||
ininPager();
|
||||
bindEvent();
|
||||
});
|
||||
|
||||
|
||||
|
||||
//初始化表格数据
|
||||
function initTableData() {
|
||||
//改变宽度和高度
|
||||
$("#searchPanel").panel({width:webW-2});
|
||||
$("#tablePanel").panel({width:webW-2});
|
||||
$('#tableData').datagrid({
|
||||
//title:'单位列表',
|
||||
//iconCls:'icon-save',
|
||||
//width:700,
|
||||
height:heightInfo,
|
||||
nowrap: false,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
pagination: true,
|
||||
//自动截取数据
|
||||
//nowrap : true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: initPageSize,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
||||
{ title: '操作',field: 'op',align:"center",width:60,formatter:function(value, rec,index)
|
||||
{
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/6 9:33
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js实现
|
||||
*/
|
||||
var str = '';
|
||||
// var rowInfo = rec.id + 'AaBb' + rec.supplier +'AaBb' + rec.contacts + 'AaBb'+ rec.phonenum + 'AaBb'+ rec.email + 'AaBb'+ rec.beginneedget + 'AaBb'+ rec.beginneedpay + 'AaBb' + rec.isystem + 'AaBb' + rec.description+ 'AaBb' + rec.type
|
||||
// + 'AaBb' + rec.fax + 'AaBb' + rec.telephone + 'AaBb' + rec.address + 'AaBb' + rec.taxnum + 'AaBb' + rec.bankname + 'AaBb' + rec.accountnumber + 'AaBb' + rec.taxrate;
|
||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editSupplier(\'' + index + '\');"/> ';
|
||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteSupplier(\'' + rec.id + '\');"/>';
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{ title: '名称',field: 'supplier',width:150},
|
||||
{ title: '联系人', field: 'contacts',width:50,align:"center"},
|
||||
{ title: '手机号码', field: 'telephone',width:100,align:"center"},
|
||||
{ title: '电子邮箱',field: 'email',width:80,align:"center"},
|
||||
{ title: '联系电话', field: 'phonenum',width:100,align:"center"},
|
||||
{ title: '传真', field: 'fax',width:100,align:"center"},
|
||||
{ title: '预付款',field: 'advancein',width:70,align:"center"},
|
||||
{ title: '期初应收',field: 'beginneedget',width:70,align:"center"},
|
||||
{ title: '期初应付',field: 'beginneedpay',width:70,align:"center"},
|
||||
{ title: '税率(%)', field: 'taxrate',width:50,align:"center"},
|
||||
{ title: '状态',field: 'enabled',width:70,align:"center",formatter:function(value){
|
||||
return value? "启用":"禁用";
|
||||
}}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'addSupplier',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
addSuppler();
|
||||
}
|
||||
},'-',
|
||||
{
|
||||
id:'deleteSupplier',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function() {
|
||||
batDeleteSupplier();
|
||||
}
|
||||
},'-',
|
||||
{
|
||||
id:'setEnable',
|
||||
text:'启用',
|
||||
iconCls:'icon-ok',
|
||||
handler:function() {
|
||||
setEnableFun();
|
||||
}
|
||||
},'-',
|
||||
{
|
||||
id:'setDisEnable',
|
||||
text:'禁用',
|
||||
iconCls:'icon-no',
|
||||
handler:function() {
|
||||
setDisEnableFun();
|
||||
}
|
||||
},'-',
|
||||
{
|
||||
id:'setInput',
|
||||
text:'导入',
|
||||
iconCls:'icon-excel',
|
||||
handler:function() {
|
||||
setInputFun();
|
||||
}
|
||||
},'-',
|
||||
{
|
||||
id:'setOutput',
|
||||
text:'导出',
|
||||
iconCls:'icon-excel',
|
||||
handler:function() {
|
||||
setOutputFun();
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
showSupplierDetails(1,initPageSize);
|
||||
}
|
||||
|
||||
|
||||
//分页信息处理
|
||||
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
|
||||
});
|
||||
showSupplierDetails(pageNum,pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
||||
}
|
||||
}
|
||||
|
||||
//删除信息
|
||||
function deleteSupplier(id) {
|
||||
$.messager.confirm('删除确认','确定要删除此条信息吗?',function(r) {
|
||||
if (r) {
|
||||
// var supplierTotalInfo = supplierInfo.split("AaBb");
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/supplier/batchDeleteSupplierByIds",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
ids : id
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=id;
|
||||
jsondata.deleteType='2';
|
||||
var type='single';
|
||||
batDeleteSupplierForceConfirm(res,"/supplier/batchDeleteSupplierByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量删除单位
|
||||
function batDeleteSupplier() {
|
||||
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;
|
||||
}
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/supplier/batchDeleteSupplierByIds",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
ids : ids
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked", false);
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=ids;
|
||||
jsondata.deleteType='2';
|
||||
var type='batch';
|
||||
batDeleteSupplierForceConfirm(res,"/supplier/batchDeleteSupplierByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 确认强制删除
|
||||
* */
|
||||
function batDeleteSupplierForceConfirm(res,url,jsondata) {
|
||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: (jsondata),
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
if(type=='batch'){
|
||||
$(":checkbox").attr("checked", false);
|
||||
}
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
}else {
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量启用
|
||||
function setEnableFun() {
|
||||
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;
|
||||
}
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/supplier/batchSetEnable",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
enabled: true,
|
||||
supplierIDs : ids
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked", false);
|
||||
} else {
|
||||
$.messager.alert('启用提示', '启用信息失败,请稍后再试!', 'error');
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('启用提示','启用信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//批量禁用
|
||||
function setDisEnableFun() {
|
||||
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;
|
||||
}
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/supplier/batchSetEnable",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
enabled: false,
|
||||
supplierIDs : ids
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked", false);
|
||||
} else {
|
||||
$.messager.alert('禁用提示', '禁用信息失败,请稍后再试!', 'error');
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('禁用提示','禁用信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//导入数据
|
||||
function setInputFun(){
|
||||
//IE下不允许编辑 input=file的值 解决思路:重新克隆input=file,把这个input元素复制一个,然后将原来的删除。
|
||||
//在IE下复制元素的时候,其中的值是不会被复制的,所以就达到了清空文件域的目的了。
|
||||
//而在Firefox下,其中的值也会被一同复制,清空一下就做到兼容
|
||||
var fileUploadInput = $("#supplierFile");
|
||||
fileUploadInput.after(fileUploadInput.clone().val(""));
|
||||
fileUploadInput.remove();
|
||||
$("#isCheck").val(1);
|
||||
$('#importExcelDlg').dialog('open').dialog('setTitle','导入' + listType + '信息');
|
||||
$(".window-mask").css({ width: webW-20 ,height: webH});
|
||||
$("#supplierFile").focus();
|
||||
}
|
||||
|
||||
//导出数据
|
||||
function setOutputFun(){
|
||||
var supplier = $.trim($("#searchSupplier").val());
|
||||
var phonenum = $.trim($("#searchPhonenum").val());
|
||||
var telephone = $.trim($("#searchTelephone").val());
|
||||
var description = $.trim($("#searchDesc").val());
|
||||
var browserType=getOs();
|
||||
window.location.href = "/supplier/exportExcel?browserType=" + browserType
|
||||
+ "&supplier=" + supplier + "&type=" + listType + "&phonenum=" + phonenum + "&telephone=" + telephone + "&description=" + description;
|
||||
}
|
||||
|
||||
//增加单位
|
||||
var url;
|
||||
var supplierID = 0;
|
||||
//保存编辑前的名称
|
||||
var oldSupplier = "";
|
||||
|
||||
function addSuppler() {
|
||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加'+listType+"信息");
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
$("#supplier").focus();
|
||||
$('#supplierFM').form('clear');
|
||||
oldSupplier = "";
|
||||
supplierID = 0;
|
||||
url = '/supplier/add';
|
||||
}
|
||||
|
||||
function bindEvent(){
|
||||
//导入excel对话框
|
||||
$('#importExcelDlg').dialog({
|
||||
width: 400,
|
||||
closed: true,
|
||||
cache: false,
|
||||
modal: true,
|
||||
collapsible:false,
|
||||
closable: true,
|
||||
buttons:'#dlg-buttons5'
|
||||
});
|
||||
//导入excel表格
|
||||
$("#saveimport").unbind().bind({
|
||||
click:function() {
|
||||
if($("#supplierFile").val().length == 0)
|
||||
{
|
||||
$.messager.alert('提示','请选择文件!','info');
|
||||
return;
|
||||
}
|
||||
$("#importExcelFM").submit();
|
||||
$('#importExcelDlg').dialog('close');
|
||||
|
||||
$.messager.progress({
|
||||
title:'请稍候',
|
||||
msg:'数据处理ing...'
|
||||
});
|
||||
setTimeout(function(){
|
||||
$.messager.progress('close');
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showSupplierDetails(opts.pageNumber,opts.pageSize);
|
||||
},3300);
|
||||
}
|
||||
});
|
||||
//保存信息
|
||||
$("#saveSupplier").off("click").on("click", function () {
|
||||
if(validateForm("supplierFM")) {
|
||||
return;
|
||||
}
|
||||
if (checkSupplierName()) {
|
||||
return;
|
||||
}
|
||||
var reg = /^([0-9])+$/;
|
||||
var phonenum = $.trim($("#phonenum").val());
|
||||
if(phonenum.length>0 && !reg.test(phonenum)) {
|
||||
$.messager.alert('提示','电话号码只能是数字','info');
|
||||
$("#phonenum").val("").focus();
|
||||
return;
|
||||
}
|
||||
var beginNeedGet = $.trim($("#BeginNeedGet").val());
|
||||
var beginNeedPay = $.trim($("#BeginNeedPay").val());
|
||||
if(beginNeedGet && beginNeedPay) {
|
||||
$.messager.alert('提示','期初应收和期初应付不能同时输入','info');
|
||||
return;
|
||||
}
|
||||
|
||||
var obj = $("#supplierFM").serializeObject();
|
||||
obj.type = listType;
|
||||
obj.enabled = 1;
|
||||
$.ajax({
|
||||
url: url,
|
||||
type:"post",
|
||||
dataType: "json",
|
||||
data:{
|
||||
info: JSON.stringify(obj)
|
||||
},
|
||||
success: function(res) {
|
||||
if(res && res.code === 200) {
|
||||
$('#supplierDlg').dialog('close');
|
||||
//加载完以后重新初始化
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showSupplierDetails(opts.pageNumber, opts.pageSize);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//初始化键盘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键盘事件
|
||||
if(k == "13"&&(obj.id=="supplier" || obj.id=="contacts"|| obj.id=="phonenum"
|
||||
|| obj.id=="email" || obj.id=="description" ))
|
||||
{
|
||||
$("#saveSupplier").click();
|
||||
}
|
||||
|
||||
//搜索按钮添加快捷键
|
||||
if(k == "13"&&(obj.id=="searchSupplier" || obj.id=="searchContacts"|| obj.id=="searchPhonenum"
|
||||
|| obj.id=="searchEmail" || obj.id=="searchDesc" ))
|
||||
{
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
//搜索处理
|
||||
$("#searchBtn").unbind().bind({
|
||||
click:function() {
|
||||
showSupplierDetails(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
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$("#searchBtn").click();
|
||||
|
||||
//重置按钮
|
||||
$("#searchResetBtn").unbind().bind({
|
||||
click:function(){
|
||||
$("#searchSupplier").val("");
|
||||
$("#searchType").val("");
|
||||
$("#searchPhonenum").val("");
|
||||
$("#searchTelephone").val("");
|
||||
$("#searchDesc").val("");
|
||||
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
//编辑信息
|
||||
function editSupplier(index) {
|
||||
// var supplierInfo = supplierTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
var beginNeedGet = rowsdata.beginneedget;
|
||||
var beginNeedPay = rowsdata.beginneedpay;
|
||||
var row = {
|
||||
supplier : rowsdata.supplier,
|
||||
contacts : (rowsdata.contacts).replace("undefined",""),
|
||||
phonenum : (rowsdata.phonenum).replace("undefined",""),
|
||||
email : (rowsdata.email).replace("undefined",""),
|
||||
BeginNeedGet : beginNeedGet == "0"? "":beginNeedGet,
|
||||
BeginNeedPay : beginNeedPay == "0"? "":beginNeedPay,
|
||||
AllNeedGet: "",
|
||||
AllNeedPay: "",
|
||||
description : (rowsdata.description).replace("undefined",""),
|
||||
type : rowsdata.type,
|
||||
fax : (rowsdata.fax).replace("undefined",""),
|
||||
telephone : (rowsdata.telephone).replace("undefined",""),
|
||||
address : (rowsdata.address).replace("undefined",""),
|
||||
taxNum : (rowsdata.taxnum).replace("undefined",""),
|
||||
bankName : (rowsdata.bankname).replace("undefined",""),
|
||||
accountNumber : (rowsdata.accountnumber).replace("undefined",""),
|
||||
taxRate : rowsdata.taxrate==undefined?"":rowsdata.taxrate
|
||||
};
|
||||
oldSupplier = rowsdata.supplier;
|
||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑'+listType +"信息");
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
$('#supplierFM').form('load',row);
|
||||
supplierID = rowsdata.id;
|
||||
//焦点在名称输入框==定焦在输入文字后面
|
||||
$("#supplier").val("").focus().val(rowsdata.supplier);
|
||||
url = '/supplier/update?id=' + rowsdata.id;
|
||||
|
||||
//显示累计应收和累计应付
|
||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||
var supType = "customer";
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/depotHead/findTotalPay",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
data: ({
|
||||
supplierId: rowsdata.id,
|
||||
endTime:thisDateTime,
|
||||
supType: supType
|
||||
}),
|
||||
success: function(res){
|
||||
if (res && res.code === 200 && res.data && res.data.rows && res.data.rows.getAllMoney !== "") {
|
||||
var moneyA = res.data.rows.getAllMoney.toFixed(2)-0;
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/accountHead/findTotalPay",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
data: ({
|
||||
supplierId: rowsdata.id,
|
||||
endTime:thisDateTime,
|
||||
supType: supType
|
||||
}),
|
||||
success: function(res){
|
||||
if (res && res.code === 200 && res.data && res.data.rows && res.data.rows.getAllMoney !== "") {
|
||||
var moneyB = res.data.rows.getAllMoney.toFixed(2)-0;
|
||||
var money = moneyA+moneyB;
|
||||
var moneyBeginNeedGet = $("#BeginNeedGet").val()-0; //期初应收
|
||||
var moneyBeginNeedPay = $("#BeginNeedPay").val()-0; //期初应付
|
||||
money = (money + moneyBeginNeedGet - moneyBeginNeedPay).toFixed(2);
|
||||
$("#AllNeedGet").val(money); //累计应收
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
$.messager.alert('提示','网络异常请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
$.messager.alert('提示','网络异常请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//检查单位名称是否存在 ++ 重名无法提示问题需要跟进
|
||||
function checkSupplierName() {
|
||||
var supplierName = $.trim($("#supplier").val());
|
||||
//表示是否存在 true == 存在 false = 不存在
|
||||
var flag = false;
|
||||
//开始ajax名称检验,不能重名
|
||||
if(supplierName.length > 0 &&( oldSupplier.length ==0 || supplierName != oldSupplier)) {
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/supplier/checkIsNameExist",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
id : supplierID,
|
||||
name : supplierName
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
if(res.data && res.data.status) {
|
||||
flag = res.data.status;
|
||||
if (flag) {
|
||||
$.messager.alert('提示', '单位名称已经存在', 'info');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('提示','检查单位名称是否存在异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
function showSupplierDetails(pageNo,pageSize) {
|
||||
var supplier = $.trim($("#searchSupplier").val());
|
||||
var phonenum = $.trim($("#searchPhonenum").val());
|
||||
var telephone = $.trim($("#searchTelephone").val());
|
||||
var description = $.trim($("#searchDesc").val());
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/supplier/list",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
search: JSON.stringify({
|
||||
supplier: supplier,
|
||||
type: listType,
|
||||
phonenum: phonenum,
|
||||
telephone: telephone,
|
||||
description: description
|
||||
}),
|
||||
currentPage: pageNo,
|
||||
pageSize: pageSize
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200){
|
||||
if(res.data && res.data.page) {
|
||||
$("#tableData").datagrid('loadData', res.data.page);
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,715 +0,0 @@
|
||||
var listType = "会员"; //类型
|
||||
var listTypeEn = "Member"; //英文类型
|
||||
//初始化界面
|
||||
$(function() {
|
||||
initTableData();
|
||||
ininPager();
|
||||
bindEvent();
|
||||
});
|
||||
|
||||
|
||||
//初始化表格数据
|
||||
function initTableData() {
|
||||
//改变宽度和高度
|
||||
$("#searchPanel").panel({width:webW-2});
|
||||
$("#tablePanel").panel({width:webW-2});
|
||||
$('#tableData').datagrid({
|
||||
//title:'单位列表',
|
||||
//iconCls:'icon-save',
|
||||
//width:700,
|
||||
height:heightInfo,
|
||||
nowrap: false,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
pagination: true,
|
||||
//自动截取数据
|
||||
//nowrap : true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: initPageSize,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
||||
{ title: '操作',field: 'op',align:"center",width:60,formatter:function(value, rec,index)
|
||||
{
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/6 9:33
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js实现
|
||||
*/
|
||||
var str = '';
|
||||
// var rowInfo = rec.id + 'AaBb' + rec.supplier +'AaBb' + rec.contacts + 'AaBb'+ rec.phonenum + 'AaBb'+ rec.email + 'AaBb'+ rec.beginneedget + 'AaBb'+ rec.beginneedpay + 'AaBb' + rec.isystem + 'AaBb' + rec.description+ 'AaBb' + rec.type
|
||||
// + 'AaBb' + rec.fax + 'AaBb' + rec.telephone + 'AaBb' + rec.address + 'AaBb' + rec.taxnum + 'AaBb' + rec.bankname + 'AaBb' + rec.accountnumber + 'AaBb' + rec.taxrate;
|
||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editSupplier(\'' + index + '\');"/> ';
|
||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteSupplier(\'' + rec.id + '\');"/>';
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{ title: '名称',field: 'supplier',width:150},
|
||||
{ title: '联系人', field: 'contacts',width:50,align:"center"},
|
||||
{ title: '手机号码', field: 'telephone',width:100,align:"center"},
|
||||
{ title: '电子邮箱',field: 'email',width:80,align:"center"},
|
||||
{ title: '联系电话', field: 'phonenum',width:100,align:"center"},
|
||||
{ title: '传真', field: 'fax',width:100,align:"center"},
|
||||
{ title: '预付款',field: 'advancein',width:70,align:"center"},
|
||||
{ title: '期初应收',field: 'beginneedget',width:70,align:"center"},
|
||||
{ title: '期初应付',field: 'beginneedpay',width:70,align:"center"},
|
||||
{ title: '税率(%)', field: 'taxrate',width:50,align:"center"},
|
||||
{ title: '状态',field: 'enabled',width:70,align:"center",formatter:function(value){
|
||||
return value? "启用":"禁用";
|
||||
}}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'addSupplier',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
addSuppler();
|
||||
}
|
||||
},'-',
|
||||
{
|
||||
id:'deleteSupplier',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function() {
|
||||
batDeleteSupplier();
|
||||
}
|
||||
},'-',
|
||||
{
|
||||
id:'setEnable',
|
||||
text:'启用',
|
||||
iconCls:'icon-ok',
|
||||
handler:function() {
|
||||
setEnableFun();
|
||||
}
|
||||
},'-',
|
||||
{
|
||||
id:'setDisEnable',
|
||||
text:'禁用',
|
||||
iconCls:'icon-no',
|
||||
handler:function() {
|
||||
setDisEnableFun();
|
||||
}
|
||||
},'-',
|
||||
{
|
||||
id:'setInput',
|
||||
text:'导入',
|
||||
iconCls:'icon-excel',
|
||||
handler:function() {
|
||||
setInputFun();
|
||||
}
|
||||
},'-',
|
||||
{
|
||||
id:'setOutput',
|
||||
text:'导出',
|
||||
iconCls:'icon-excel',
|
||||
handler:function() {
|
||||
setOutputFun();
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
showSupplierDetails(1,initPageSize);
|
||||
}
|
||||
|
||||
|
||||
//分页信息处理
|
||||
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
|
||||
});
|
||||
showSupplierDetails(pageNum,pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
||||
}
|
||||
}
|
||||
|
||||
//删除信息
|
||||
function deleteSupplier(id) {
|
||||
$.messager.confirm('删除确认','确定要删除此条信息吗?',function(r) {
|
||||
if (r) {
|
||||
// var supplierTotalInfo = supplierInfo.split("AaBb");
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/supplier/batchDeleteSupplierByIds",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
ids : id
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=id;
|
||||
jsondata.deleteType='2';
|
||||
var type='single';
|
||||
batDeleteSupplierForceConfirm(res,"/supplier/batchDeleteSupplierByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量删除单位
|
||||
function batDeleteSupplier() {
|
||||
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;
|
||||
}
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/supplier/batchDeleteSupplierByIds",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
ids : ids
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked", false);
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=ids;
|
||||
jsondata.deleteType='2';
|
||||
var type='batch';
|
||||
batDeleteSupplierForceConfirm(res,"/supplier/batchDeleteSupplierByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 确认强制删除
|
||||
* */
|
||||
function batDeleteSupplierForceConfirm(res,url,jsondata) {
|
||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: (jsondata),
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
if(type=='batch'){
|
||||
$(":checkbox").attr("checked", false);
|
||||
}
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
}else {
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量启用
|
||||
function setEnableFun() {
|
||||
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;
|
||||
}
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/supplier/batchSetEnable",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
enabled: true,
|
||||
supplierIDs : ids
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked", false);
|
||||
} else {
|
||||
$.messager.alert('启用提示', '启用信息失败,请稍后再试!', 'error');
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('启用提示','启用信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//批量禁用
|
||||
function setDisEnableFun() {
|
||||
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;
|
||||
}
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/supplier/batchSetEnable",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
enabled: false,
|
||||
supplierIDs : ids
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked", false);
|
||||
} else {
|
||||
$.messager.alert('禁用提示', '禁用信息失败,请稍后再试!', 'error');
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('禁用提示','禁用信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//导入数据
|
||||
function setInputFun(){
|
||||
//IE下不允许编辑 input=file的值 解决思路:重新克隆input=file,把这个input元素复制一个,然后将原来的删除。
|
||||
//在IE下复制元素的时候,其中的值是不会被复制的,所以就达到了清空文件域的目的了。
|
||||
//而在Firefox下,其中的值也会被一同复制,清空一下就做到兼容
|
||||
var fileUploadInput = $("#supplierFile");
|
||||
fileUploadInput.after(fileUploadInput.clone().val(""));
|
||||
fileUploadInput.remove();
|
||||
$("#isCheck").val(1);
|
||||
$('#importExcelDlg').dialog('open').dialog('setTitle','导入' + listType + '信息');
|
||||
$(".window-mask").css({ width: webW-20 ,height: webH});
|
||||
$("#supplierFile").focus();
|
||||
}
|
||||
|
||||
//导出数据
|
||||
function setOutputFun(){
|
||||
var supplier = $.trim($("#searchSupplier").val());
|
||||
var phonenum = $.trim($("#searchPhonenum").val());
|
||||
var telephone = $.trim($("#searchTelephone").val());
|
||||
var description = $.trim($("#searchDesc").val());
|
||||
var browserType=getOs();
|
||||
window.location.href = "/supplier/exportExcel?browserType=" + browserType
|
||||
+ "&supplier=" + supplier + "&type=" + listType + "&phonenum=" + phonenum + "&telephone=" + telephone + "&description=" + description;
|
||||
}
|
||||
|
||||
//增加单位
|
||||
var url;
|
||||
var supplierID = 0;
|
||||
//保存编辑前的名称
|
||||
var oldSupplier = "";
|
||||
|
||||
function addSuppler() {
|
||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加'+listType+"信息");
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
$("#supplier").focus();
|
||||
$('#supplierFM').form('clear');
|
||||
oldSupplier = "";
|
||||
supplierID = 0;
|
||||
url = '/supplier/add';
|
||||
}
|
||||
|
||||
function bindEvent(){
|
||||
//导入excel对话框
|
||||
$('#importExcelDlg').dialog({
|
||||
width: 400,
|
||||
closed: true,
|
||||
cache: false,
|
||||
modal: true,
|
||||
collapsible:false,
|
||||
closable: true,
|
||||
buttons:'#dlg-buttons5'
|
||||
});
|
||||
//导入excel表格
|
||||
$("#saveimport").unbind().bind({
|
||||
click:function() {
|
||||
if($("#supplierFile").val().length == 0)
|
||||
{
|
||||
$.messager.alert('提示','请选择文件!','info');
|
||||
return;
|
||||
}
|
||||
$("#importExcelFM").submit();
|
||||
$('#importExcelDlg').dialog('close');
|
||||
|
||||
$.messager.progress({
|
||||
title:'请稍候',
|
||||
msg:'数据处理ing...'
|
||||
});
|
||||
setTimeout(function(){
|
||||
$.messager.progress('close');
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showSupplierDetails(opts.pageNumber,opts.pageSize);
|
||||
},3300);
|
||||
}
|
||||
});
|
||||
//保存信息
|
||||
$("#saveSupplier").off("click").on("click", function () {
|
||||
if(validateForm("supplierFM")) {
|
||||
return;
|
||||
}
|
||||
if (checkSupplierName()) {
|
||||
return;
|
||||
}
|
||||
var reg = /^([0-9])+$/;
|
||||
var phonenum = $.trim($("#phonenum").val());
|
||||
if(phonenum.length>0 && !reg.test(phonenum)) {
|
||||
$.messager.alert('提示','电话号码只能是数字','info');
|
||||
$("#phonenum").val("").focus();
|
||||
return;
|
||||
}
|
||||
var beginNeedGet = $.trim($("#BeginNeedGet").val());
|
||||
var beginNeedPay = $.trim($("#BeginNeedPay").val());
|
||||
if(beginNeedGet && beginNeedPay) {
|
||||
$.messager.alert('提示','期初应收和期初应付不能同时输入','info');
|
||||
return;
|
||||
}
|
||||
|
||||
var obj = $("#supplierFM").serializeObject();
|
||||
obj.type = listType;
|
||||
obj.enabled = 1;
|
||||
$.ajax({
|
||||
url: url,
|
||||
type:"post",
|
||||
dataType: "json",
|
||||
data:{
|
||||
info: JSON.stringify(obj)
|
||||
},
|
||||
success: function(res) {
|
||||
if(res && res.code === 200) {
|
||||
$('#supplierDlg').dialog('close');
|
||||
//加载完以后重新初始化
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showSupplierDetails(opts.pageNumber, opts.pageSize);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//初始化键盘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键盘事件
|
||||
if(k == "13"&&(obj.id=="supplier" || obj.id=="contacts"|| obj.id=="phonenum"
|
||||
|| obj.id=="email" || obj.id=="description" ))
|
||||
{
|
||||
$("#saveSupplier").click();
|
||||
}
|
||||
|
||||
//搜索按钮添加快捷键
|
||||
if(k == "13"&&(obj.id=="searchSupplier" || obj.id=="searchContacts"|| obj.id=="searchPhonenum"
|
||||
|| obj.id=="searchEmail" || obj.id=="searchDesc" ))
|
||||
{
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
//搜索处理
|
||||
$("#searchBtn").unbind().bind({
|
||||
click:function() {
|
||||
showSupplierDetails(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
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$("#searchBtn").click();
|
||||
|
||||
//重置按钮
|
||||
$("#searchResetBtn").unbind().bind({
|
||||
click:function(){
|
||||
$("#searchSupplier").val("");
|
||||
$("#searchType").val("");
|
||||
$("#searchPhonenum").val("");
|
||||
$("#searchTelephone").val("");
|
||||
$("#searchDesc").val("");
|
||||
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
//编辑信息
|
||||
function editSupplier(index) {
|
||||
// var supplierInfo = supplierTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
var beginNeedGet = rowsdata.beginneedget;
|
||||
var beginNeedPay = rowsdata.beginneedpay;
|
||||
var row = {
|
||||
supplier : rowsdata.supplier,
|
||||
contacts : (rowsdata.contacts).replace("undefined",""),
|
||||
phonenum : (rowsdata.phonenum).replace("undefined",""),
|
||||
email : (rowsdata.email).replace("undefined",""),
|
||||
BeginNeedGet : beginNeedGet == "0"? "":beginNeedGet,
|
||||
BeginNeedPay : beginNeedPay == "0"? "":beginNeedPay,
|
||||
AllNeedGet: "",
|
||||
AllNeedPay: "",
|
||||
description : (rowsdata.description).replace("undefined",""),
|
||||
type : rowsdata.type,
|
||||
fax : (rowsdata.fax).replace("undefined",""),
|
||||
telephone : (rowsdata.telephone).replace("undefined",""),
|
||||
address : (rowsdata.address).replace("undefined",""),
|
||||
taxNum : (rowsdata.taxnum).replace("undefined",""),
|
||||
bankName : (rowsdata.bankname).replace("undefined",""),
|
||||
accountNumber : (rowsdata.accountnumber).replace("undefined",""),
|
||||
taxRate : rowsdata.taxrate==undefined?"":rowsdata.taxrate
|
||||
};
|
||||
oldSupplier = rowsdata.supplier;
|
||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑'+listType +"信息");
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
$('#supplierFM').form('load',row);
|
||||
supplierID = rowsdata.id;
|
||||
//焦点在名称输入框==定焦在输入文字后面
|
||||
$("#supplier").val("").focus().val(rowsdata.supplier);
|
||||
url = '/supplier/update?id=' + rowsdata.id;
|
||||
|
||||
//显示累计应收和累计应付
|
||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||
var supType = "customer";
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/depotHead/findTotalPay",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
data: ({
|
||||
supplierId: rowsdata.id,
|
||||
endTime:thisDateTime,
|
||||
supType: supType
|
||||
}),
|
||||
success: function(res){
|
||||
if (res && res.code === 200 && res.data && res.data.rows && res.data.rows.getAllMoney !== "") {
|
||||
var moneyA = res.data.rows.getAllMoney.toFixed(2)-0;
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/accountHead/findTotalPay",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
data: ({
|
||||
supplierId: rowsdata.id,
|
||||
endTime:thisDateTime,
|
||||
supType: supType
|
||||
}),
|
||||
success: function(res){
|
||||
if (res && res.code === 200 && res.data && res.data.rows && res.data.rows.getAllMoney !== "") {
|
||||
var moneyB = res.data.rows.getAllMoney.toFixed(2)-0;
|
||||
var money = moneyA+moneyB;
|
||||
var moneyBeginNeedGet = $("#BeginNeedGet").val()-0; //期初应收
|
||||
var moneyBeginNeedPay = $("#BeginNeedPay").val()-0; //期初应付
|
||||
/**
|
||||
* 会员该做什么操作呢?
|
||||
*
|
||||
* */
|
||||
if(listType === "客户"){
|
||||
money = (money + moneyBeginNeedGet - moneyBeginNeedPay).toFixed(2);
|
||||
$("#AllNeedGet").val(money); //累计应收
|
||||
}
|
||||
else if(listType === "供应商"){
|
||||
money = (money + moneyBeginNeedPay - moneyBeginNeedGet).toFixed(2);
|
||||
$("#AllNeedPay").val(money); //累计应付
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
$.messager.alert('提示','网络异常请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
$.messager.alert('提示','网络异常请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//检查单位名称是否存在 ++ 重名无法提示问题需要跟进
|
||||
function checkSupplierName() {
|
||||
var supplierName = $.trim($("#supplier").val());
|
||||
//表示是否存在 true == 存在 false = 不存在
|
||||
var flag = false;
|
||||
//开始ajax名称检验,不能重名
|
||||
if(supplierName.length > 0 &&( oldSupplier.length ==0 || supplierName != oldSupplier)) {
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/supplier/checkIsNameExist",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
id : supplierID,
|
||||
name : supplierName
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
if(res.data && res.data.status) {
|
||||
flag = res.data.status;
|
||||
if (flag) {
|
||||
$.messager.alert('提示', '单位名称已经存在', 'info');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('提示','检查单位名称是否存在异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
function showSupplierDetails(pageNo,pageSize) {
|
||||
var supplier = $.trim($("#searchSupplier").val());
|
||||
var phonenum = $.trim($("#searchPhonenum").val());
|
||||
var telephone = $.trim($("#searchTelephone").val());
|
||||
var description = $.trim($("#searchDesc").val());
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/supplier/list",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
search: JSON.stringify({
|
||||
supplier: supplier,
|
||||
type: listType,
|
||||
phonenum: phonenum,
|
||||
telephone: telephone,
|
||||
description: description
|
||||
}),
|
||||
currentPage: pageNo,
|
||||
pageSize: pageSize
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200){
|
||||
if(res.data && res.data.page) {
|
||||
$("#tableData").datagrid('loadData', res.data.page);
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -1,705 +0,0 @@
|
||||
//初始化界面
|
||||
var listType = "供应商"; //类型
|
||||
var listTypeEn = "Vendor"; //英文类型
|
||||
$(function() {
|
||||
initTableData();
|
||||
ininPager();
|
||||
bindEvent();
|
||||
});
|
||||
|
||||
|
||||
//初始化表格数据
|
||||
function initTableData() {
|
||||
//改变宽度和高度
|
||||
$("#searchPanel").panel({width:webW-2});
|
||||
$("#tablePanel").panel({width:webW-2});
|
||||
$('#tableData').datagrid({
|
||||
//title:'单位列表',
|
||||
//iconCls:'icon-save',
|
||||
//width:700,
|
||||
height:heightInfo,
|
||||
nowrap: false,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate:false,
|
||||
//选中单行
|
||||
singleSelect : true,
|
||||
collapsible:false,
|
||||
selectOnCheck:false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
checkOnSelect : false,
|
||||
//交替出现背景
|
||||
striped : true,
|
||||
pagination: true,
|
||||
//自动截取数据
|
||||
//nowrap : true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: initPageSize,
|
||||
pageList: initPageNum,
|
||||
columns:[[
|
||||
{ field: 'id',width:35,align:"center",checkbox:true},
|
||||
{ title: '操作',field: 'op',align:"center",width:60,formatter:function(value, rec,index)
|
||||
{
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/6 9:33
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js实现
|
||||
*/
|
||||
var str = '';
|
||||
// var rowInfo = rec.id + 'AaBb' + rec.supplier +'AaBb' + rec.contacts + 'AaBb'+ rec.phonenum + 'AaBb'+ rec.email + 'AaBb'+ rec.beginneedget + 'AaBb'+ rec.beginneedpay + 'AaBb' + rec.isystem + 'AaBb' + rec.description+ 'AaBb' + rec.type
|
||||
// + 'AaBb' + rec.fax + 'AaBb' + rec.telephone + 'AaBb' + rec.address + 'AaBb' + rec.taxnum + 'AaBb' + rec.bankname + 'AaBb' + rec.accountnumber + 'AaBb' + rec.taxrate;
|
||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editSupplier(\'' + index + '\');"/> ';
|
||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteSupplier(\'' + rec.id + '\');"/>';
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{ title: '名称',field: 'supplier',width:150},
|
||||
{ title: '联系人', field: 'contacts',width:50,align:"center"},
|
||||
{ title: '手机号码', field: 'telephone',width:100,align:"center"},
|
||||
{ title: '电子邮箱',field: 'email',width:80,align:"center"},
|
||||
{ title: '联系电话', field: 'phonenum',width:100,align:"center"},
|
||||
{ title: '传真', field: 'fax',width:100,align:"center"},
|
||||
{ title: '预付款',field: 'advancein',width:70,align:"center"},
|
||||
{ title: '期初应收',field: 'beginneedget',width:70,align:"center"},
|
||||
{ title: '期初应付',field: 'beginneedpay',width:70,align:"center"},
|
||||
{ title: '税率(%)', field: 'taxrate',width:50,align:"center"},
|
||||
{ title: '状态',field: 'enabled',width:70,align:"center",formatter:function(value){
|
||||
return value? "启用":"禁用";
|
||||
}}
|
||||
]],
|
||||
toolbar:[
|
||||
{
|
||||
id:'addSupplier',
|
||||
text:'增加',
|
||||
iconCls:'icon-add',
|
||||
handler:function() {
|
||||
addSuppler();
|
||||
}
|
||||
},'-',
|
||||
{
|
||||
id:'deleteSupplier',
|
||||
text:'删除',
|
||||
iconCls:'icon-remove',
|
||||
handler:function() {
|
||||
batDeleteSupplier();
|
||||
}
|
||||
},'-',
|
||||
{
|
||||
id:'setEnable',
|
||||
text:'启用',
|
||||
iconCls:'icon-ok',
|
||||
handler:function() {
|
||||
setEnableFun();
|
||||
}
|
||||
},'-',
|
||||
{
|
||||
id:'setDisEnable',
|
||||
text:'禁用',
|
||||
iconCls:'icon-no',
|
||||
handler:function() {
|
||||
setDisEnableFun();
|
||||
}
|
||||
},'-',
|
||||
{
|
||||
id:'setInput',
|
||||
text:'导入',
|
||||
iconCls:'icon-excel',
|
||||
handler:function() {
|
||||
setInputFun();
|
||||
}
|
||||
},'-',
|
||||
{
|
||||
id:'setOutput',
|
||||
text:'导出',
|
||||
iconCls:'icon-excel',
|
||||
handler:function() {
|
||||
setOutputFun();
|
||||
}
|
||||
}
|
||||
],
|
||||
onLoadError:function() {
|
||||
$.messager.alert('页面加载提示','页面加载异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
showSupplierDetails(1,initPageSize);
|
||||
}
|
||||
|
||||
|
||||
//分页信息处理
|
||||
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
|
||||
});
|
||||
showSupplierDetails(pageNum,pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
$.messager.alert('异常处理提示',"分页信息异常 : " + e.name + ": " + e.message,'error');
|
||||
}
|
||||
}
|
||||
|
||||
//删除信息
|
||||
function deleteSupplier(id) {
|
||||
$.messager.confirm('删除确认','确定要删除此条信息吗?',function(r) {
|
||||
if (r) {
|
||||
// var supplierTotalInfo = supplierInfo.split("AaBb");
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/supplier/batchDeleteSupplierByIds",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
ids : id
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=id;
|
||||
jsondata.deleteType='2';
|
||||
var type='single';
|
||||
batDeleteSupplierForceConfirm(res,"/supplier/batchDeleteSupplierByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量删除单位
|
||||
function batDeleteSupplier() {
|
||||
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;
|
||||
}
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/supplier/batchDeleteSupplierByIds",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
ids : ids
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked", false);
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=ids;
|
||||
jsondata.deleteType='2';
|
||||
var type='batch';
|
||||
batDeleteSupplierForceConfirm(res,"/supplier/batchDeleteSupplierByIds",jsondata,type);
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
}else{
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('删除提示','删除信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 确认强制删除
|
||||
* */
|
||||
function batDeleteSupplierForceConfirm(res,url,jsondata) {
|
||||
$.messager.confirm('删除确认', res.msg, function (r) {
|
||||
if (r) {
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: url,
|
||||
dataType: "json",
|
||||
data: (jsondata),
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
$("#searchBtn").click();
|
||||
if(type=='batch'){
|
||||
$(":checkbox").attr("checked", false);
|
||||
}
|
||||
}else if(res && res.code == 600){
|
||||
$.messager.alert('删除提示', res.msg, 'error');
|
||||
}else {
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('删除提示', '删除信息失败,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//批量启用
|
||||
function setEnableFun() {
|
||||
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;
|
||||
}
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/supplier/batchSetEnable",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
enabled: true,
|
||||
supplierIDs : ids
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked", false);
|
||||
} else {
|
||||
$.messager.alert('启用提示', '启用信息失败,请稍后再试!', 'error');
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('启用提示','启用信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//批量禁用
|
||||
function setDisEnableFun() {
|
||||
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;
|
||||
}
|
||||
ids += row[i].id + ",";
|
||||
}
|
||||
$.ajax({
|
||||
type:"post",
|
||||
url: "/supplier/batchSetEnable",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
enabled: false,
|
||||
supplierIDs : ids
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
$("#searchBtn").click();
|
||||
$(":checkbox").attr("checked", false);
|
||||
} else {
|
||||
$.messager.alert('禁用提示', '禁用信息失败,请稍后再试!', 'error');
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('禁用提示','禁用信息异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//导入数据
|
||||
function setInputFun(){
|
||||
//IE下不允许编辑 input=file的值 解决思路:重新克隆input=file,把这个input元素复制一个,然后将原来的删除。
|
||||
//在IE下复制元素的时候,其中的值是不会被复制的,所以就达到了清空文件域的目的了。
|
||||
//而在Firefox下,其中的值也会被一同复制,清空一下就做到兼容
|
||||
var fileUploadInput = $("#supplierFile");
|
||||
fileUploadInput.after(fileUploadInput.clone().val(""));
|
||||
fileUploadInput.remove();
|
||||
$("#isCheck").val(1);
|
||||
$('#importExcelDlg').dialog('open').dialog('setTitle','导入' + listType + '信息');
|
||||
$(".window-mask").css({ width: webW-20 ,height: webH});
|
||||
$("#supplierFile").focus();
|
||||
}
|
||||
|
||||
//导出数据
|
||||
function setOutputFun(){
|
||||
var supplier = $.trim($("#searchSupplier").val());
|
||||
var phonenum = $.trim($("#searchPhonenum").val());
|
||||
var telephone = $.trim($("#searchTelephone").val());
|
||||
var description = $.trim($("#searchDesc").val());
|
||||
var browserType=getOs();
|
||||
window.location.href = "/supplier/exportExcel?browserType=" + browserType
|
||||
+ "&supplier=" + supplier + "&type=" + listType + "&phonenum=" + phonenum + "&telephone=" + telephone + "&description=" + description;
|
||||
}
|
||||
|
||||
//增加单位
|
||||
var url;
|
||||
var supplierID = 0;
|
||||
//保存编辑前的名称
|
||||
var oldSupplier = "";
|
||||
|
||||
function addSuppler() {
|
||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/edit_add.png"/> 增加'+listType+"信息");
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
$("#supplier").focus();
|
||||
$('#supplierFM').form('clear');
|
||||
oldSupplier = "";
|
||||
supplierID = 0;
|
||||
url = '/supplier/add';
|
||||
}
|
||||
|
||||
function bindEvent(){
|
||||
//导入excel对话框
|
||||
$('#importExcelDlg').dialog({
|
||||
width: 400,
|
||||
closed: true,
|
||||
cache: false,
|
||||
modal: true,
|
||||
collapsible:false,
|
||||
closable: true,
|
||||
buttons:'#dlg-buttons5'
|
||||
});
|
||||
//导入excel表格
|
||||
$("#saveimport").unbind().bind({
|
||||
click:function() {
|
||||
if($("#supplierFile").val().length == 0)
|
||||
{
|
||||
$.messager.alert('提示','请选择文件!','info');
|
||||
return;
|
||||
}
|
||||
$("#importExcelFM").submit();
|
||||
$('#importExcelDlg').dialog('close');
|
||||
|
||||
$.messager.progress({
|
||||
title:'请稍候',
|
||||
msg:'数据处理ing...'
|
||||
});
|
||||
setTimeout(function(){
|
||||
$.messager.progress('close');
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showSupplierDetails(opts.pageNumber,opts.pageSize);
|
||||
},3300);
|
||||
}
|
||||
});
|
||||
//保存信息
|
||||
$("#saveSupplier").off("click").on("click", function () {
|
||||
if(validateForm("supplierFM")) {
|
||||
return;
|
||||
}
|
||||
if (checkSupplierName()) {
|
||||
return;
|
||||
}
|
||||
var reg = /^([0-9])+$/;
|
||||
var phonenum = $.trim($("#phonenum").val());
|
||||
if(phonenum.length>0 && !reg.test(phonenum)) {
|
||||
$.messager.alert('提示','电话号码只能是数字','info');
|
||||
$("#phonenum").val("").focus();
|
||||
return;
|
||||
}
|
||||
var beginNeedGet = $.trim($("#BeginNeedGet").val());
|
||||
var beginNeedPay = $.trim($("#BeginNeedPay").val());
|
||||
if(beginNeedGet && beginNeedPay) {
|
||||
$.messager.alert('提示','期初应收和期初应付不能同时输入','info');
|
||||
return;
|
||||
}
|
||||
|
||||
var obj = $("#supplierFM").serializeObject();
|
||||
obj.type = listType;
|
||||
obj.enabled = 1;
|
||||
$.ajax({
|
||||
url: url,
|
||||
type:"post",
|
||||
dataType: "json",
|
||||
data:{
|
||||
info: JSON.stringify(obj)
|
||||
},
|
||||
success: function(res) {
|
||||
if(res && res.code === 200) {
|
||||
$('#supplierDlg').dialog('close');
|
||||
//加载完以后重新初始化
|
||||
var opts = $("#tableData").datagrid('options');
|
||||
showSupplierDetails(opts.pageNumber, opts.pageSize);
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
//初始化键盘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键盘事件
|
||||
if(k == "13"&&(obj.id=="supplier" || obj.id=="contacts"|| obj.id=="phonenum"
|
||||
|| obj.id=="email" || obj.id=="description" ))
|
||||
{
|
||||
$("#saveSupplier").click();
|
||||
}
|
||||
|
||||
//搜索按钮添加快捷键
|
||||
if(k == "13"&&(obj.id=="searchSupplier" || obj.id=="searchContacts"|| obj.id=="searchPhonenum"
|
||||
|| obj.id=="searchEmail" || obj.id=="searchDesc" ))
|
||||
{
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
//搜索处理
|
||||
$("#searchBtn").unbind().bind({
|
||||
click:function() {
|
||||
showSupplierDetails(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
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
$("#searchBtn").click();
|
||||
|
||||
//重置按钮
|
||||
$("#searchResetBtn").unbind().bind({
|
||||
click:function(){
|
||||
$("#searchSupplier").val("");
|
||||
$("#searchType").val("");
|
||||
$("#searchPhonenum").val("");
|
||||
$("#searchTelephone").val("");
|
||||
$("#searchDesc").val("");
|
||||
|
||||
//加载完以后重新初始化
|
||||
$("#searchBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
//编辑信息
|
||||
function editSupplier(index) {
|
||||
// var supplierInfo = supplierTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
var beginNeedGet = rowsdata.beginneedget;
|
||||
var beginNeedPay = rowsdata.beginneedpay;
|
||||
var row = {
|
||||
supplier : rowsdata.supplier,
|
||||
contacts : (rowsdata.contacts).replace("undefined",""),
|
||||
phonenum : (rowsdata.phonenum).replace("undefined",""),
|
||||
email : (rowsdata.email).replace("undefined",""),
|
||||
BeginNeedGet : beginNeedGet == "0"? "":beginNeedGet,
|
||||
BeginNeedPay : beginNeedPay == "0"? "":beginNeedPay,
|
||||
AllNeedGet: "",
|
||||
AllNeedPay: "",
|
||||
description : (rowsdata.description).replace("undefined",""),
|
||||
type : rowsdata.type,
|
||||
fax : (rowsdata.fax).replace("undefined",""),
|
||||
telephone : (rowsdata.telephone).replace("undefined",""),
|
||||
address : (rowsdata.address).replace("undefined",""),
|
||||
taxNum : (rowsdata.taxnum).replace("undefined",""),
|
||||
bankName : (rowsdata.bankname).replace("undefined",""),
|
||||
accountNumber : (rowsdata.accountnumber).replace("undefined",""),
|
||||
taxRate : rowsdata.taxrate==undefined?"":rowsdata.taxrate
|
||||
};
|
||||
oldSupplier = rowsdata.supplier;
|
||||
$('#supplierDlg').dialog('open').dialog('setTitle','<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑'+listType +"信息");
|
||||
$(".window-mask").css({ width: webW ,height: webH});
|
||||
$('#supplierFM').form('load',row);
|
||||
supplierID = rowsdata.id;
|
||||
//焦点在名称输入框==定焦在输入文字后面
|
||||
$("#supplier").val("").focus().val(rowsdata.supplier);
|
||||
url = '/supplier/update?id=' + rowsdata.id;
|
||||
|
||||
//显示累计应收和累计应付
|
||||
var thisDateTime = getNowFormatDateTime(); //当前时间
|
||||
var supType = "vendor";
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/depotHead/findTotalPay",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
data: ({
|
||||
supplierId: rowsdata.id,
|
||||
endTime:thisDateTime,
|
||||
supType: supType
|
||||
}),
|
||||
success: function(res){
|
||||
if (res && res.code === 200 && res.data && res.data.rows && res.data.rows.getAllMoney !== "") {
|
||||
var moneyA = res.data.rows.getAllMoney.toFixed(2)-0;
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/accountHead/findTotalPay",
|
||||
dataType: "json",
|
||||
async: false,
|
||||
data: ({
|
||||
supplierId: rowsdata.id,
|
||||
endTime:thisDateTime,
|
||||
supType: supType
|
||||
}),
|
||||
success: function(res){
|
||||
if (res && res.code === 200 && res.data && res.data.rows && res.data.rows.getAllMoney !== "") {
|
||||
var moneyB = res.data.rows.getAllMoney.toFixed(2)-0;
|
||||
var money = moneyA+moneyB;
|
||||
var moneyBeginNeedGet = $("#BeginNeedGet").val()-0; //期初应收
|
||||
var moneyBeginNeedPay = $("#BeginNeedPay").val()-0; //期初应付
|
||||
money = (money + moneyBeginNeedPay - moneyBeginNeedGet).toFixed(2);
|
||||
$("#AllNeedPay").val(money); //累计应付
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
$.messager.alert('提示','网络异常请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
error: function(){
|
||||
$.messager.alert('提示','网络异常请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
//检查单位名称是否存在 ++ 重名无法提示问题需要跟进
|
||||
function checkSupplierName() {
|
||||
var supplierName = $.trim($("#supplier").val());
|
||||
//表示是否存在 true == 存在 false = 不存在
|
||||
var flag = false;
|
||||
//开始ajax名称检验,不能重名
|
||||
if(supplierName.length > 0 &&( oldSupplier.length ==0 || supplierName != oldSupplier)) {
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/supplier/checkIsNameExist",
|
||||
dataType: "json",
|
||||
async : false,
|
||||
data: ({
|
||||
id : supplierID,
|
||||
name : supplierName
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
if(res.data && res.data.status) {
|
||||
flag = res.data.status;
|
||||
if (flag) {
|
||||
$.messager.alert('提示', '单位名称已经存在', 'info');
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('提示','检查单位名称是否存在异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
return flag;
|
||||
}
|
||||
|
||||
|
||||
function showSupplierDetails(pageNo,pageSize) {
|
||||
var supplier = $.trim($("#searchSupplier").val());
|
||||
var phonenum = $.trim($("#searchPhonenum").val());
|
||||
var telephone = $.trim($("#searchTelephone").val());
|
||||
var description = $.trim($("#searchDesc").val());
|
||||
$.ajax({
|
||||
type:"get",
|
||||
url: "/supplier/list",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
search: JSON.stringify({
|
||||
supplier: supplier,
|
||||
type: listType,
|
||||
phonenum: phonenum,
|
||||
telephone: telephone,
|
||||
description: description
|
||||
}),
|
||||
currentPage: pageNo,
|
||||
pageSize: pageSize
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200){
|
||||
if(res.data && res.data.page) {
|
||||
$("#tableData").datagrid('loadData', res.data.page);
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error:function() {
|
||||
$.messager.alert('查询提示','查询数据后台异常,请稍后再试!','error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@
|
||||
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<script src="/js/pages/financial/advance_in.js"></script>
|
||||
<script src="/js/pages/financial/financial_base.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<script src="/js/pages/financial/giro.js"></script>
|
||||
<script src="/js/pages/financial/financial_base.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<script src="/js/pages/financial/item_in.js"></script>
|
||||
<script src="/js/pages/financial/financial_base.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<script src="/js/pages/financial/item_out.js"></script>
|
||||
<script src="/js/pages/financial/financial_base.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<script src="/js/pages/financial/money_in.js"></script>
|
||||
<script src="/js/pages/financial/financial_base.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<script src="/js/pages/financial/money_out.js"></script>
|
||||
<script src="/js/pages/financial/financial_base.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
|
||||
@@ -129,18 +129,12 @@
|
||||
},
|
||||
{title: '备注', field: 'remark', width: 100},
|
||||
{
|
||||
title: '操作', field: 'op', align: "center", width: 210, formatter: function (value, rec,index) {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/5 10:30
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js实现
|
||||
*/
|
||||
title: '操作', field: 'op', align: "center", width: 210, formatter: function (value, rec) {
|
||||
var str = '';
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountInOutList(\'' + index + '\');"/> <a onclick="showAccountInOutList(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">流水</a> ';
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccount(\'' + index + '\');"/> <a onclick="editAccount(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccount(\'' + rec.id + '\');"/> <a onclick="deleteAccount(\'' + rec.id + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||
var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.serialno + 'AaBb' + rec.initialamount + 'AaBb' + rec.currentamount + 'AaBb' + rec.remark;
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountInOutList(\'' + rowInfo + '\');"/> <a onclick="showAccountInOutList(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">流水</a> ';
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editAccount(\'' + rowInfo + '\');"/> <a onclick="editAccount(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteAccount(\'' + rowInfo + '\');"/> <a onclick="deleteAccount(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||
return str;
|
||||
}
|
||||
}
|
||||
@@ -221,16 +215,16 @@
|
||||
}
|
||||
|
||||
//删除结算账户
|
||||
function deleteAccount(id) {
|
||||
function deleteAccount(accountInfo) {
|
||||
$.messager.confirm('删除确认', '确定要删除此结算账户吗?', function (r) {
|
||||
if (r) {
|
||||
// var accountTotalInfo = accountInfo.split("AaBb");
|
||||
var accountTotalInfo = accountInfo.split("AaBb");
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/account/batchDeleteAccountByIds",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
ids: id
|
||||
ids: accountTotalInfo[0]
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
@@ -238,7 +232,7 @@
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=id;
|
||||
jsondata.ids=accountTotalInfo[0];
|
||||
jsondata.deleteType='2';
|
||||
var type='single';
|
||||
batDeleteAccountForceConfirm(res,"/account/batchDeleteAccountByIds",jsondata,type);
|
||||
@@ -443,22 +437,23 @@
|
||||
});
|
||||
|
||||
//编辑结算账户
|
||||
function editAccount(index) {
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
function editAccount(accountTotalInfo) {
|
||||
var accountInfo = accountTotalInfo.split("AaBb");
|
||||
var row = {
|
||||
name: rowsdata.name,
|
||||
serialNo: rowsdata.serialNo,
|
||||
initialAmount: rowsdata.initialamount,
|
||||
currentAmount: rowsdata.currentamount,
|
||||
remark: rowsdata.remark
|
||||
name: accountInfo[1],
|
||||
serialNo: accountInfo[2],
|
||||
initialAmount: accountInfo[3],
|
||||
currentAmount: accountInfo[4],
|
||||
remark: accountInfo[5]
|
||||
};
|
||||
oldAccount = rowsdata.name;
|
||||
oldAccount = accountInfo[1];
|
||||
$('#accountDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑结算账户');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
$('#accountFM').form('load', row);
|
||||
accountID = accountInfo[0];
|
||||
//焦点在名称输入框==定焦在输入文字后面
|
||||
$("#account").val("").focus().val(rowsdata.name);
|
||||
url = '/account/update?id=' + rowsdata.id;
|
||||
$("#account").val("").focus().val(accountInfo[1]);
|
||||
url = '/account/update?id=' + accountInfo[0];
|
||||
}
|
||||
|
||||
//检查结算账户 名称是否存在 ++ 重名无法提示问题需要跟进
|
||||
@@ -545,11 +540,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
function showAccountInOutList(index) {
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
var accountId = rowsdata.id;
|
||||
var initialAmount = rowsdata.serialno;
|
||||
function showAccountInOutList(accountInfo) {
|
||||
var info = accountInfo.split("AaBb");
|
||||
var accountId = info[0];
|
||||
var initialAmount = info[3];
|
||||
$('#accountDetailListDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 查看账户流水');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
initAccountDetailData(accountId);
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<script type="text/javascript" src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
||||
<script type="text/javascript" src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script type="text/javascript" src="/js/common/common.js"></script>
|
||||
<script src="/js/pages/manage/customer.js"></script>
|
||||
<script src="/js/pages/manage/supplier.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
|
||||
@@ -483,26 +483,25 @@
|
||||
});
|
||||
|
||||
//编辑信息
|
||||
function editDepot(index) {
|
||||
// var depotInfo = depotTotalInfo.split("AaBb");
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
function editDepot(depotTotalInfo) {
|
||||
var depotInfo = depotTotalInfo.split("AaBb");
|
||||
|
||||
$("#name").focus().val(rowsdata.name);
|
||||
$("#sort").val(rowsdata.sort);
|
||||
$("#remark").val(rowsdata.remark);
|
||||
$("#address").val(rowsdata.address);
|
||||
$("#warehousing").val(rowsdata.warehousing);
|
||||
$("#truckage").val(rowsdata.truckage);
|
||||
$("#principalName").val(transferUndefined(rowsdata.principalName));
|
||||
$("#principal").val(transferUndefined(rowsdata.principal));
|
||||
$("#name").focus().val(depotInfo[1]);
|
||||
$("#sort").val(depotInfo[2]);
|
||||
$("#remark").val(depotInfo[3]);
|
||||
$("#address").val(depotInfo[4]);
|
||||
$("#warehousing").val(depotInfo[5].replace("undefined",""));
|
||||
$("#truckage").val(depotInfo[6].replace("undefined",""));
|
||||
$("#principalName").val(depotInfo[7]);
|
||||
$("#principal").val(depotInfo[8]);
|
||||
$("#selectType").val("principal");
|
||||
oldDepot = rowsdata.name;
|
||||
oldDepot = depotInfo[1];
|
||||
$('#depotDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑仓库信息');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
depotID = rowsdata.id;
|
||||
depotID = depotInfo[0];
|
||||
//焦点在名称输入框==定焦在输入文字后面
|
||||
$("#name").val("").focus().val(rowsdata.name);
|
||||
url = '/depot/update?id=' + rowsdata.id;
|
||||
$("#name").val("").focus().val(depotInfo[1]);
|
||||
url = '/depot/update?id=' + depotInfo[0];
|
||||
}
|
||||
|
||||
//检查名称是否存在 ++ 重名无法提示问题需要跟进
|
||||
|
||||
@@ -167,11 +167,11 @@
|
||||
},
|
||||
{title: '类型', field: 'type', width: 50},
|
||||
{
|
||||
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec,index) {
|
||||
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec) {
|
||||
var str = '';
|
||||
// var rowInfo = rec.id + 'AaBb' + rec.number + 'AaBb' + rec.name + 'AaBb' + rec.pnumber + 'AaBb' + rec.url
|
||||
// + 'AaBb' + rec.state + 'AaBb' + rec.sort + 'AaBb' + rec.enabled + 'AaBb' + rec.type + 'AaBb' + rec.pushbtn;
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editFunctions(\'' + index + '\');"/> <a onclick="editFunctions(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
var rowInfo = rec.id + 'AaBb' + rec.number + 'AaBb' + rec.name + 'AaBb' + rec.pnumber + 'AaBb' + rec.url
|
||||
+ 'AaBb' + rec.state + 'AaBb' + rec.sort + 'AaBb' + rec.enabled + 'AaBb' + rec.type + 'AaBb' + rec.pushbtn;
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editFunctions(\'' + rowInfo + '\');"/> <a onclick="editFunctions(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteFunctions(' + rec.id + ');"/> <a onclick="deleteFunctions(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||
return str;
|
||||
}
|
||||
@@ -381,20 +381,19 @@
|
||||
});
|
||||
|
||||
//编辑信息
|
||||
function editFunctions(index) {
|
||||
// var functionsInfo = functionsTotalInfo.split("AaBb");
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#Number").focus().val(rowsdata.number);
|
||||
$("#Name").focus().val(rowsdata.name);
|
||||
$("#PNumber").focus().val(rowsdata.pnumber);
|
||||
$("#URL").focus().val(rowsdata.url);
|
||||
$("#State").attr("checked", rowsdata.state === true ? true : false);
|
||||
$("#Sort").focus().val(rowsdata.sort);
|
||||
$("#Enabled").attr("checked", rowsdata.enabled === true ? true : false);
|
||||
$("#Type").focus().val(rowsdata.type);
|
||||
var pushbtn=rowsdata.pushbtn;
|
||||
if (pushbtn) {
|
||||
var arr = pushbtn.split(",");
|
||||
function editFunctions(functionsTotalInfo) {
|
||||
var functionsInfo = functionsTotalInfo.split("AaBb");
|
||||
|
||||
$("#Number").focus().val(functionsInfo[1]);
|
||||
$("#Name").focus().val(functionsInfo[2]);
|
||||
$("#PNumber").focus().val(functionsInfo[3]);
|
||||
$("#URL").focus().val(functionsInfo[4]);
|
||||
$("#State").attr("checked", functionsInfo[5] == 'true' ? true : false);
|
||||
$("#Sort").focus().val(functionsInfo[6]);
|
||||
$("#Enabled").attr("checked", functionsInfo[7] == 'true' ? true : false);
|
||||
$("#Type").focus().val(functionsInfo[8]);
|
||||
if (functionsInfo[9] !== "undefined" && functionsInfo[9] !== "") {
|
||||
var arr = functionsInfo[9].split(",");
|
||||
var pushBtnArray = [];
|
||||
for (var i = 0; i < arr.length; i++) {
|
||||
if (arr[i]) {
|
||||
@@ -409,13 +408,13 @@
|
||||
$("#PushBtn").combobox('setValues', '');
|
||||
}
|
||||
|
||||
oldFunctions = rowsdata.name;
|
||||
oldFunctions = functionsInfo[2];
|
||||
$('#functionsDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑功能信息');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
functionsID = rowsdata.id;
|
||||
functionsID = functionsInfo[0];
|
||||
//焦点在名称输入框==定焦在输入文字后面
|
||||
$("#Name").val("").focus().val(rowsdata.name);
|
||||
url = '/functions/update?id=' + rowsdata.id;
|
||||
$("#Name").val("").focus().val(functionsInfo[2]);
|
||||
url = '/functions/update?id=' + functionsInfo[0];
|
||||
}
|
||||
|
||||
//检查名称是否存在 ++ 重名无法提示问题需要跟进
|
||||
|
||||
@@ -136,18 +136,11 @@
|
||||
{title: '类型', field: 'type', width: 100, align: "center"},
|
||||
{title: '描述', field: 'remark', width: 200},
|
||||
{
|
||||
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec,index) {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/5 10:30
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js实现
|
||||
*/
|
||||
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec) {
|
||||
var str = '';
|
||||
// var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.type + 'AaBb' + rec.remark;
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editInOutItem(\'' + index + '\');"/> <a onclick="editInOutItem(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteInOutItem(\'' + rec.id + '\');"/> <a onclick="deleteInOutItem(\'' + rec.id + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||
var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.type + 'AaBb' + rec.remark;
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editInOutItem(\'' + rowInfo + '\');"/> <a onclick="editInOutItem(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteInOutItem(\'' + rowInfo + '\');"/> <a onclick="deleteInOutItem(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||
return str;
|
||||
}
|
||||
}
|
||||
@@ -221,16 +214,16 @@
|
||||
}
|
||||
|
||||
//删除收支项目
|
||||
function deleteInOutItem(id) {
|
||||
function deleteInOutItem(inOutItemInfo) {
|
||||
$.messager.confirm('删除确认', '确定要删除此收支项目吗?', function (r) {
|
||||
if (r) {
|
||||
// var inOutItemTotalInfo = inOutItemInfo.split("AaBb");
|
||||
var inOutItemTotalInfo = inOutItemInfo.split("AaBb");
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/inOutItem/batchDeleteInOutItemByIds",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
ids: id
|
||||
ids: inOutItemTotalInfo[0]
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code == 200) {
|
||||
@@ -238,7 +231,7 @@
|
||||
} else {
|
||||
if(res && res.code == 601){
|
||||
var jsondata={};
|
||||
jsondata.ids=id;
|
||||
jsondata.ids=inOutItemTotalInfo[0];
|
||||
jsondata.deleteType='2';
|
||||
var type='single';
|
||||
batDeleteInOutItemForceConfirm(res,"/inOutItem/batchDeleteInOutItemByIds",jsondata,type);
|
||||
@@ -400,23 +393,21 @@
|
||||
});
|
||||
|
||||
//编辑收支项目
|
||||
function editInOutItem(index) {
|
||||
// var inOutItemInfo = inOutItemTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
function editInOutItem(inOutItemTotalInfo) {
|
||||
var inOutItemInfo = inOutItemTotalInfo.split("AaBb");
|
||||
var row = {
|
||||
name: rowsdata.name,
|
||||
type: rowsdata.type,
|
||||
remark: rowsdata.remark
|
||||
name: inOutItemInfo[1],
|
||||
type: inOutItemInfo[2],
|
||||
remark: inOutItemInfo[3]
|
||||
};
|
||||
oldInOutItem = rowsdata.name;
|
||||
oldInOutItem = inOutItemInfo[1];
|
||||
$('#inOutItemDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑收支项目');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
$('#inOutItemFM').form('load', row);
|
||||
inOutItemID = rowsdata.id;
|
||||
inOutItemID = inOutItemInfo[0];
|
||||
//焦点在名称输入框==定焦在输入文字后面
|
||||
$("#inOutItem").val("").focus().val(rowsdata.name);
|
||||
url = '/inOutItem/update?id=' + rowsdata.id;
|
||||
$("#inOutItem").val("").focus().val(inOutItemInfo[1]);
|
||||
url = '/inOutItem/update?id=' + inOutItemInfo[0];
|
||||
}
|
||||
|
||||
//检查收支项目 名称是否存在 ++ 重名无法提示问题需要跟进
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<script type="text/javascript" src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
||||
<script type="text/javascript" src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script type="text/javascript" src="/js/common/common.js"></script>
|
||||
<script src="/js/pages/manage/member.js"></script>
|
||||
<script src="/js/pages/manage/supplier.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
|
||||
@@ -117,17 +117,10 @@
|
||||
{field: 'id', width: 35, align: "center", checkbox: true},
|
||||
{title: '角色名称', field: 'name', width: 200},
|
||||
{
|
||||
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec,index) {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/5 10:30
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js实现
|
||||
*/
|
||||
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec) {
|
||||
var str = '';
|
||||
// var rowInfo = rec.id + 'AaBb' + rec.name;
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editRole(\'' + index + '\');"/> <a onclick="editRole(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
var rowInfo = rec.id + 'AaBb' + rec.name;
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editRole(\'' + rowInfo + '\');"/> <a onclick="editRole(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteRole(' + rec.id + ');"/> <a onclick="deleteRole(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||
return str;
|
||||
}
|
||||
@@ -320,18 +313,18 @@
|
||||
});
|
||||
|
||||
//编辑信息
|
||||
function editRole(index) {
|
||||
// var roleInfo = roleTotalInfo.split("AaBb");
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#name").focus().val(rowsdata.name);
|
||||
function editRole(roleTotalInfo) {
|
||||
var roleInfo = roleTotalInfo.split("AaBb");
|
||||
|
||||
oldName = rowsdata.name;
|
||||
$("#name").focus().val(roleInfo[1]);
|
||||
|
||||
oldName = roleInfo[1];
|
||||
$('#roleDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑角色信息');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
roleID = rowsdata.id;
|
||||
roleID = roleInfo[0];
|
||||
//焦点在名称输入框==定焦在输入文字后面
|
||||
$("#name").val("").focus().val(rowsdata.name);
|
||||
url = '/role/update?id=' + rowsdata.id;
|
||||
$("#name").val("").focus().val(roleInfo[1]);
|
||||
url = '/role/update?id=' + roleInfo[0];
|
||||
}
|
||||
|
||||
//检查名称是否存在 ++ 重名无法提示问题需要跟进
|
||||
@@ -393,7 +386,9 @@
|
||||
url: "/role/list",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
name: searchName,
|
||||
search: JSON.stringify({
|
||||
name: searchName
|
||||
}),
|
||||
currentPage: pageNo,
|
||||
pageSize: pageSize
|
||||
}),
|
||||
|
||||
@@ -48,17 +48,16 @@
|
||||
}
|
||||
}
|
||||
//cnodes = cnodes.substring(0, cnodes.length - 1);
|
||||
// pnodes = pnodes.substring(0, pnodes.length - 1);
|
||||
pnodes = pnodes.substring(0, pnodes.length - 1);
|
||||
|
||||
if (ctype == 'child') {
|
||||
return cnodes;
|
||||
}
|
||||
else if("all"){
|
||||
return cnodes+pnodes;
|
||||
}else{
|
||||
return pnodes;
|
||||
else {
|
||||
return pnodes
|
||||
}
|
||||
}
|
||||
;
|
||||
};
|
||||
|
||||
$(function () {
|
||||
|
||||
@@ -85,7 +84,7 @@
|
||||
info: JSON.stringify({
|
||||
type: type,
|
||||
keyid: url_id,
|
||||
value: GetNode('all')
|
||||
value: GetNode('child')
|
||||
})
|
||||
},
|
||||
dataType: "json",
|
||||
|
||||
@@ -133,18 +133,12 @@
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '操作', field: 'op', width: 160, formatter: function (value, rec,index) {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/6 9:33
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js实现
|
||||
*/
|
||||
title: '操作', field: 'op', width: 160, formatter: function (value, rec) {
|
||||
var str = '';
|
||||
// var rowInfo = rec.id + 'AaBb' + rec.companyName + 'AaBb' + rec.companyContacts + 'AaBb' + rec.companyAddress
|
||||
// + 'AaBb' + rec.companyTel + 'AaBb' + rec.companyFax + 'AaBb' + rec.companyPostCode;
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editSystemConfig(\'' + index + '\');"/> <a onclick="editSystemConfig(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
var rowInfo = rec.id + 'AaBb' + rec.companyName + 'AaBb' + rec.companyContacts + 'AaBb' + rec.companyAddress
|
||||
+ 'AaBb' + rec.companyTel + 'AaBb' + rec.companyFax + 'AaBb' + rec.companyPostCode
|
||||
+ 'AaBb' + rec.depotFlag + 'AaBb' + rec.customerFlag;
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editSystemConfig(\'' + rowInfo + '\');"/> <a onclick="editSystemConfig(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteSystemConfig(' + rec.id + ');"/> <a onclick="deleteSystemConfig(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||
return str;
|
||||
}
|
||||
@@ -357,26 +351,26 @@
|
||||
});
|
||||
|
||||
//编辑系统配置信息
|
||||
function editSystemConfig(index) {
|
||||
// var systemConfigInfo = systemConfigTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
function editSystemConfig(systemConfigTotalInfo) {
|
||||
var systemConfigInfo = systemConfigTotalInfo.split("AaBb");
|
||||
var row = {
|
||||
companyName: rowsdata.companyName,
|
||||
companyContacts: rowsdata.companyContacts,
|
||||
companyAddress: rowsdata.companyAddress,
|
||||
companyTel: rowsdata.companyTel,
|
||||
companyFax: rowsdata.companyFax,
|
||||
companyPostCode: rowsdata.companyPostCode
|
||||
companyName: systemConfigInfo[1],
|
||||
companyContacts: systemConfigInfo[2],
|
||||
companyAddress: systemConfigInfo[3],
|
||||
companyTel: systemConfigInfo[4],
|
||||
companyFax: systemConfigInfo[5],
|
||||
companyPostCode: systemConfigInfo[6]
|
||||
};
|
||||
oldCompanyName = rowsdata.companyName;
|
||||
oldCompanyName = systemConfigInfo[1];
|
||||
$('#systemConfigDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑系统配置信息');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
$('#systemConfigFM').form('load', row);
|
||||
systemConfigId = rowsdata.id;
|
||||
systemConfigId = systemConfigInfo[0];
|
||||
//焦点在名称输入框==定焦在输入文字后面
|
||||
$("#companyName").val("").focus().val(rowsdata.companyName);
|
||||
url = '/systemConfig/update?id=' + rowsdata.id;
|
||||
$("#companyName").val("").focus().val(systemConfigInfo[1]);
|
||||
$("#depotFlag").attr("checked", systemConfigInfo[7] == '1' ? true : false);
|
||||
$("#customerFlag").attr("checked", systemConfigInfo[8] == '1' ? true : false);
|
||||
url = '/systemConfig/update?id=' + systemConfigInfo[0];
|
||||
}
|
||||
|
||||
//检查系统配置 名称是否存在 ++ 重名无法提示问题需要跟进
|
||||
|
||||
@@ -110,17 +110,10 @@
|
||||
{field: 'id', width: 35, align: "center", checkbox: true},
|
||||
{
|
||||
title: '操作', field: 'op', align: "center", width: 60,
|
||||
formatter: function (value, rec,index) {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/6 9:33
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js实现
|
||||
*/
|
||||
formatter: function (value, rec) {
|
||||
var str = '';
|
||||
// var rowInfo = rec.id + 'AaBb' + rec.uname;
|
||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editUnit(\'' + index + '\');"/> ';
|
||||
var rowInfo = rec.id + 'AaBb' + rec.uname;
|
||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editUnit(\'' + rowInfo + '\');"/> ';
|
||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteUnit(' + rec.id + ');"/>';
|
||||
return str;
|
||||
}
|
||||
@@ -372,16 +365,15 @@
|
||||
});
|
||||
|
||||
//编辑信息
|
||||
function editUnit(index) {
|
||||
// var unitInfo = unitTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
oldUnit = rowsdata.uname;
|
||||
function editUnit(unitTotalInfo) {
|
||||
var unitInfo = unitTotalInfo.split("AaBb");
|
||||
|
||||
oldUnit = unitInfo[1];
|
||||
$('#unitDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑计量单位');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
unitID = rowsdata.id;
|
||||
unitID = unitInfo[0];
|
||||
//焦点在名称输入框==定焦在输入文字后面
|
||||
var name = rowsdata.uname;
|
||||
var name = unitInfo[1];
|
||||
var basicName = name.substring(0, name.indexOf(",")); //基础单位
|
||||
$("#basicName").val(basicName);
|
||||
var otherItem = name.substring(name.indexOf(",") + 1);
|
||||
@@ -391,7 +383,7 @@
|
||||
lastNum = lastNum.replace(")", "");
|
||||
$("#otherNum").val(lastNum);
|
||||
$("#unitName").text(basicName);
|
||||
url = '/unit/update?id=' + rowsdata.id;
|
||||
url = '/unit/update?id=' + unitInfo[0];
|
||||
}
|
||||
|
||||
//检查名称是否存在 ++ 重名无法提示问题需要跟进
|
||||
|
||||
@@ -186,20 +186,13 @@
|
||||
{title: '描述', field: 'description', width: 130},
|
||||
{field: 'orgaId',hidden:true, width: 10},
|
||||
{
|
||||
title: '操作', field: 'isystem', width: 150, formatter: function (value, rec,index) {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/6 9:33
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js实现
|
||||
*/
|
||||
title: '操作', field: 'isystem', width: 150, formatter: function (value, rec) {
|
||||
var str = '';
|
||||
// var rowInfo = rec.id + 'AaBb' + rec.username + 'AaBb' + rec.loginame + 'AaBb' + rec.position
|
||||
// + 'AaBb' + rec.orgAbr + 'AaBb' + rec.email + 'AaBb' + rec.phonenum + 'AaBb' + rec.ismanager
|
||||
// + 'AaBb' + rec.isystem + 'AaBb' + rec.description+'AaBb'+rec.orgaId+'AaBb'+rec.orgaUserRelId
|
||||
// +'AaBb' + rec.userBlngOrgaDsplSeq ;
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editUser(\'' + index + '\');"/> <a onclick="editUser(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
var rowInfo = rec.id + 'AaBb' + rec.username + 'AaBb' + rec.loginame + 'AaBb' + rec.position
|
||||
+ 'AaBb' + rec.orgAbr + 'AaBb' + rec.email + 'AaBb' + rec.phonenum + 'AaBb' + rec.ismanager
|
||||
+ 'AaBb' + rec.isystem + 'AaBb' + rec.description+'AaBb'+rec.orgaId+'AaBb'+rec.orgaUserRelId
|
||||
+'AaBb' + rec.userBlngOrgaDsplSeq ;
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editUser(\'' + rowInfo + '\');"/> <a onclick="editUser(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
if (rec.id != rec.tenantId) {
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteUser(' + rec.id + ');"/> <a onclick="deleteUser(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||
}
|
||||
@@ -449,34 +442,32 @@
|
||||
});
|
||||
|
||||
//编辑用户信息
|
||||
function editUser(index) {
|
||||
// var usernameInfo = usernameTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
function editUser(usernameTotalInfo) {
|
||||
var usernameInfo = usernameTotalInfo.split("AaBb");
|
||||
var row = {
|
||||
username: rowsdata.username,
|
||||
loginame: rowsdata.loginame,
|
||||
position: rowsdata.position,
|
||||
email: rowsdata.email,
|
||||
phonenum: rowsdata.phonenum,
|
||||
description: rowsdata.description,
|
||||
orgAbr: rowsdata.orgAbr===undefined?'':rowsdata.orgAbr,
|
||||
orgaId: rowsdata.orgaId===undefined?'':rowsdata.orgaId,
|
||||
orgaUserRelId:rowsdata.orgaUserRelId===undefined?'':rowsdata.orgaUserRelId,
|
||||
userBlngOrgaDsplSeq:rowsdata.userBlngOrgaDsplSeq===undefined?'':rowsdata.userBlngOrgaDsplSeq
|
||||
username: usernameInfo[1],
|
||||
loginame: usernameInfo[2],
|
||||
position: usernameInfo[3],
|
||||
email: usernameInfo[5],
|
||||
phonenum: usernameInfo[6],
|
||||
description: usernameInfo[9],
|
||||
orgAbr: usernameInfo[4]=='undefined'?'':usernameInfo[4],
|
||||
orgaId: usernameInfo[10]=='undefined'?'':usernameInfo[10],
|
||||
orgaUserRelId:usernameInfo[11]=='undefined'?'':usernameInfo[11],
|
||||
userBlngOrgaDsplSeq:usernameInfo[12]=='undefined'?'':usernameInfo[12]
|
||||
|
||||
};
|
||||
oldLoginName = rowsdata.username;
|
||||
oldLoginName = usernameInfo[1];
|
||||
$('#userDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑用户信息');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
$('#usernameFM').form('load', row);
|
||||
userID = rowsdata.id;
|
||||
userID = usernameInfo[0];
|
||||
//焦点在名称输入框==定焦在输入文字后面
|
||||
$("#username").val("").focus().val(rowsdata.username);
|
||||
$("#username").val("").focus().val(usernameInfo[1]);
|
||||
$("#loginame").attr("readonly","readonly");
|
||||
/**机构选择*/
|
||||
$("#selectType").val("org");
|
||||
url = '/user/updateUser?id=' + rowsdata.id;
|
||||
url = '/user/updateUser?id=' + usernameInfo[0];
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
<script type="text/javascript" src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
||||
<script type="text/javascript" src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script type="text/javascript" src="/js/common/common.js"></script>
|
||||
<script src="/js/pages/manage/vendor.js"></script>
|
||||
<script src="/js/pages/manage/supplier.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<!-- 数据显示table -->
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<!--<script src="/js/pages/materials/allocation_out_list.js"></script>-->
|
||||
<script src="/js/common/jsherp.js"></script>
|
||||
<script src="/js/pages/materials/add_temp.js"></script>
|
||||
<script src="/js/pages/materials/in_out.js"></script>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<!--<script src="/js/pages/materials/assemble_list.js"></script>-->
|
||||
<script src="/js/common/jsherp.js"></script>
|
||||
<script src="/js/pages/materials/add_temp.js"></script>
|
||||
<script src="/js/pages/materials/in_out.js"></script>
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
<script src="/js/easyui-1.3.5/jquery.easyui.min.js"></script>
|
||||
<script src="/js/easyui-1.3.5/locale/easyui-lang-zh_CN.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<!--<script src="/js/pages/materials/bill_detail.js"></script>-->
|
||||
<script src="/js/pages/materials/bill_detail.js"></script>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
@@ -16,12 +16,6 @@
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<!--<script src="/js/pages/materials/disassemble_list.js"></script>-->
|
||||
<script>
|
||||
var kid = sessionStorage.getItem("userId");
|
||||
var path = "<%=path%>";
|
||||
var clientIp = "<%=clientIp%>";
|
||||
</script>
|
||||
<script src="/js/pages/materials/add_temp.js"></script>
|
||||
<script src="/js/pages/materials/in_out.js"></script>
|
||||
</head>
|
||||
|
||||
@@ -79,7 +79,7 @@
|
||||
<td style="height:30px;">类别</td>
|
||||
<td style="padding:5px" colspan="3">
|
||||
<input name="parentName" id="parentName" style="width: 180px;height: 20px" readonly="readonly"/>
|
||||
<a href="javascript:void(0)" class="l-btn l-btn-plain" group="" id="lookForSelectMaterialCategory">
|
||||
<a href="javascript:void(0)" class="l-btn l-btn-plain" group="" id="lookForMaterialCategory">
|
||||
<span class="l-btn-left"><span class="l-btn-text icon-search l-btn-icon-left"></span></span></a>
|
||||
<input name="parentid" id="parentid" type="hidden"/>
|
||||
</td>
|
||||
@@ -277,18 +277,14 @@
|
||||
<script type="text/javascript">
|
||||
var materialCategoryList = null;
|
||||
var types = "";
|
||||
var setCategoryId = "1";
|
||||
var cid = 1;
|
||||
var multiple = 0; //倍数
|
||||
var mPropertyList = null; //商品属性列表
|
||||
var mPropertyListShort = ""; //商品属性列表-传值
|
||||
var clickType = ""; //记录从哪里点击的类别弹窗
|
||||
//初始化界面
|
||||
$(function () {
|
||||
//初始化系统基础信息
|
||||
initMProperty();
|
||||
initSystemData(1);
|
||||
initSelectInfo("search_first");
|
||||
initSelectInfo("edit_first");
|
||||
manyUnitFun();
|
||||
priceKeyUp();//价格触发事件
|
||||
initMPropertyShort(); //初始化商品属性
|
||||
@@ -323,7 +319,7 @@
|
||||
});
|
||||
}
|
||||
|
||||
function initSystemData(parentid_search) {
|
||||
function initMCData(parentid_search) {
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/materialCategory/getAllList",
|
||||
@@ -336,6 +332,16 @@
|
||||
success: function (res) {
|
||||
if(res && res.code === 200){
|
||||
materialCategoryList = res.data;
|
||||
if (materialCategoryList != null) {
|
||||
options = "";
|
||||
for (var i = 0; i < materialCategoryList.length; i++) {
|
||||
var materialCategory = materialCategoryList[i];
|
||||
types += materialCategory.id + ',';
|
||||
}
|
||||
types += parentid_search;
|
||||
} else {
|
||||
types = parentid_search;
|
||||
}
|
||||
} else {
|
||||
$.messager.alert('提示', '查找系统基础信息异常,请与管理员联系!', 'error');
|
||||
return;
|
||||
@@ -344,26 +350,6 @@
|
||||
});
|
||||
}
|
||||
|
||||
//初始化页面选项卡
|
||||
function initSelectInfo(lei) {
|
||||
var options = "";
|
||||
|
||||
if (materialCategoryList != null) {
|
||||
options = "";
|
||||
for (var i = 0; i < materialCategoryList.length; i++) {
|
||||
var materialCategory = materialCategoryList[i];
|
||||
if (0 == i) {
|
||||
mcId = materialCategory.id;
|
||||
}
|
||||
options += '<option value="' + materialCategory.id + '">' + materialCategory.name + '</option>';
|
||||
if (lei == "search_second" || lei == "type_second" || lei == "search_three") {
|
||||
types += materialCategory.id + ',';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//防止表单提交重复
|
||||
function initForm() {
|
||||
$('#materialFM').form({
|
||||
@@ -531,21 +517,14 @@
|
||||
columns: [[
|
||||
{field: 'id', width: 35, align: "center", checkbox: true},
|
||||
{
|
||||
title: '操作', field: 'op', align: "center", width: 60, formatter: function (value, rec,index) {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/6 9:33
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js实现
|
||||
*/
|
||||
title: '操作', field: 'op', align: "center", width: 60, formatter: function (value, rec) {
|
||||
var str = '';
|
||||
// var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.model + 'AaBb' + rec.color + 'AaBb' + rec.unit + 'AaBb' + rec.retailprice
|
||||
// + 'AaBb' + rec.lowprice + 'AaBb' + rec.presetpriceone + 'AaBb' + rec.presetpricetwo + 'AaBb' + rec.remark + 'AaBb' + rec.standard
|
||||
// + 'AaBb' + rec.color + 'AaBb' + rec.packing + 'AaBb' + rec.safetystock + 'AaBb' + rec.categoryid + 'AaBb' + rec.categoryName
|
||||
// + 'AaBb' + rec.unitid + 'AaBb' + rec.unitName + 'AaBb' + rec.firstoutunit + 'AaBb' + rec.firstinunit
|
||||
// + 'AaBb' + rec.mfrs + 'AaBb' + rec.otherfield1 + 'AaBb' + rec.otherfield2 + 'AaBb' + rec.otherfield3+ 'AaBb' + rec.enableserialnumber;
|
||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editMaterial(\'' + index + '\');"/> ';
|
||||
var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.model + 'AaBb' + rec.color + 'AaBb' + rec.unit + 'AaBb' + rec.retailprice
|
||||
+ 'AaBb' + rec.lowprice + 'AaBb' + rec.presetpriceone + 'AaBb' + rec.presetpricetwo + 'AaBb' + rec.remark + 'AaBb' + rec.standard
|
||||
+ 'AaBb' + rec.color + 'AaBb' + rec.packing + 'AaBb' + rec.safetystock + 'AaBb' + rec.categoryid + 'AaBb' + rec.categoryName
|
||||
+ 'AaBb' + rec.unitid + 'AaBb' + rec.unitName + 'AaBb' + rec.firstoutunit + 'AaBb' + rec.firstinunit
|
||||
+ 'AaBb' + rec.mfrs + 'AaBb' + rec.otherfield1 + 'AaBb' + rec.otherfield2 + 'AaBb' + rec.otherfield3+ 'AaBb' + rec.enableserialnumber;
|
||||
str += '<img title="编辑" src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editMaterial(\'' + rowInfo + '\');"/> ';
|
||||
str += '<img title="删除" src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deleteMaterial(' + rec.id + ');"/>';
|
||||
return str;
|
||||
}
|
||||
@@ -565,41 +544,10 @@
|
||||
},
|
||||
{title: '安全存量', field: 'safetystock', width: 70},
|
||||
{
|
||||
title: '库存', field: 'abc', width: 70, formatter: function (value, rec) {
|
||||
var monthTime = getNowFormatMonth();
|
||||
var mId = rec.id; //商品id
|
||||
var thisStock = 0;
|
||||
//查询库存
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: '/depotItem/findStockNumByMaterialId',
|
||||
data: {
|
||||
materialId: mId
|
||||
},
|
||||
dataType: "json",
|
||||
success: function (res) {
|
||||
if(res && res.code === 200) {
|
||||
if (res.data && res.data.page && res.data.page[0]) {
|
||||
thisStock = res.data.page[0].thisSum - 0;
|
||||
if (thisStock > 0) {
|
||||
$("#tablePanel .class-" + rec.id).text(thisStock); //延迟加载库存数据
|
||||
$("#tablePanel .class-" + rec.id).css("color", "blue").css("text-decoration", "underline").css("cursor", "pointer");
|
||||
$("#tablePanel .class-" + rec.id).off("click").on("click", function () {
|
||||
$('#materialDetailListDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 查看出入库明细');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
initMaterialDetailData(mId);
|
||||
getMaterialInOutList(mId, 1, initPageSize);
|
||||
ininMaterialDetailPager(mId);
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
error: function () {
|
||||
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
|
||||
}
|
||||
});
|
||||
return "<span class='class-" + rec.id + "'>" + thisStock + "</span>";
|
||||
title: '库存', field: 'stock', width: 70, formatter: function (value, rec) {
|
||||
var str = '';
|
||||
str += '<span title="查看出入库明细" class="n-link" onclick="findStockList(' + rec.id + ');">' + rec.stock + '</span>';
|
||||
return str;
|
||||
}
|
||||
},
|
||||
{title: '零售价', field: 'retailprice', width: 60,
|
||||
@@ -717,7 +665,6 @@
|
||||
pageSize: initPageSize,
|
||||
pageList: initPageNum,
|
||||
columns: [[
|
||||
|
||||
{
|
||||
title: '单据编号', field: 'Number', width: 150,
|
||||
formatter: function (value, row) {
|
||||
@@ -726,10 +673,7 @@
|
||||
},
|
||||
{title: '类型', field: 'Type', width: 100},
|
||||
{title: '数量', field: 'BasicNumber', width: 80},
|
||||
{title: '仓库', field: 'depotName', width: 180},
|
||||
{title: '日期', field: 'OperTime', width: 180},
|
||||
{title: '调入仓库', field: 'depotInName', width: 180}
|
||||
|
||||
{title: '日期', field: 'OperTime', width: 180}
|
||||
]],
|
||||
onLoadError: function () {
|
||||
$.messager.alert('页面加载提示', '页面加载异常,请稍后再试!', 'error');
|
||||
@@ -825,6 +769,14 @@
|
||||
}
|
||||
}
|
||||
|
||||
function findStockList(mId) {
|
||||
$('#materialDetailListDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 查看出入库明细');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
initMaterialDetailData(mId);
|
||||
getMaterialInOutList(mId, 1, initPageSize);
|
||||
ininMaterialDetailPager(mId);
|
||||
}
|
||||
|
||||
//删除商品信息
|
||||
function deleteMaterial(materialID) {
|
||||
$.messager.confirm('删除确认', '确定要删除此商品信息吗?', function (r) {
|
||||
@@ -1061,13 +1013,8 @@
|
||||
function setOutputFun() {
|
||||
var name = $.trim($("#searchName").val());
|
||||
var model = $.trim($("#searchModel").val());
|
||||
if (setCategoryId != "1") {
|
||||
cid = 2;
|
||||
} else {
|
||||
cid = 1;
|
||||
}
|
||||
window.location.href = "/material/exportExcel?browserType=" + getOs()
|
||||
+ "&name=" + name + "&model=" + model + "&categoryId=" + cid + "&categoryIds=" + setCategoryId;
|
||||
+ "&name=" + name + "&model=" + model + "&categoryIds=" + types;
|
||||
}
|
||||
//增加
|
||||
var url;
|
||||
@@ -1341,37 +1288,35 @@
|
||||
}
|
||||
|
||||
//编辑信息
|
||||
function editMaterial(index) {
|
||||
// var materialInfo = materialTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
function editMaterial(materialTotalInfo) {
|
||||
var materialInfo = materialTotalInfo.split("AaBb");
|
||||
bindMProperty(); //根据商品属性绑定
|
||||
$("#Name").focus().val(rowsdata.name);
|
||||
$("#Color").focus().val(rowsdata.color);
|
||||
$("#EnableSerialNumber").val(rowsdata.enableserialnumber=='1'?'1':'0');
|
||||
$("#Name").focus().val(materialInfo[1]);
|
||||
$("#Color").focus().val(materialInfo[11]);
|
||||
$("#EnableSerialNumber").val(materialInfo[24]=='1'?'1':'0');
|
||||
//商品类别id
|
||||
$("#parentid").val(rowsdata.categoryid == undefined ? "" : rowsdata.categoryid );
|
||||
$("#parentid").val(materialInfo[14] == "undefined" ? "" : materialInfo[14]);
|
||||
//商品类别名称
|
||||
$("#parentName").val(rowsdata.categoryName == undefined ? "" : rowsdata.categoryName );
|
||||
mId = rowsdata.categoryid;
|
||||
mName =rowsdata.categoryName;
|
||||
$("#Packing").focus().val(rowsdata.packing);
|
||||
$("#SafetyStock").focus().val(rowsdata.safetystock==undefined ? "" : rowsdata.safetystock);
|
||||
$("#Model").val(rowsdata.model);
|
||||
$("#Standard").val(rowsdata.standard == "undefined" ? "" : rowsdata.standard );
|
||||
$("#Color").val(rowsdata.color == "undefined" ? "" : rowsdata.color );
|
||||
$("#Mfrs").val(rowsdata.mfrs == "undefined" ? "" : rowsdata.mfrs );
|
||||
$("#OtherField1").val(rowsdata.otherfield1 == "undefined" ? "" : rowsdata.otherfield1);
|
||||
$("#OtherField2").val(rowsdata.otherfield2 == "undefined" ? "" : rowsdata.otherfield2 );
|
||||
$("#OtherField3").val(rowsdata.otherfield3 == "undefined" ? "" : rowsdata.otherfield3);
|
||||
$("#Unit").val(rowsdata.unit == "undefined" ? "" : rowsdata.unit);
|
||||
$("#RetailPrice").val(rowsdata.retailprice == "undefined" ? "" : rowsdata.retailprice);
|
||||
$("#LowPrice").val(rowsdata.lowprice == "undefined" ? "" : rowsdata.lowprice);
|
||||
$("#PresetPriceOne").val(rowsdata.presetpriceone == "undefined" ? "" : rowsdata.presetpriceone);
|
||||
$("#PresetPriceTwo").val(rowsdata.presetpricetwo == "undefined" ? "" :rowsdata.presetpricetwo);
|
||||
$("#Remark").val(rowsdata.remark);
|
||||
$("#manyUnit").val(rowsdata.unitid);
|
||||
if (rowsdata.unitid != "undefined") {
|
||||
$("#parentName").val(materialInfo[15] == "undefined" ? "" : materialInfo[15]);
|
||||
mId = materialInfo[14];
|
||||
mName = materialInfo[15];
|
||||
$("#Packing").focus().val(materialInfo[12]);
|
||||
$("#SafetyStock").focus().val(materialInfo[13]=="undefined" ? "" : materialInfo[13]);
|
||||
$("#Model").val(materialInfo[2]);
|
||||
$("#Standard").val(materialInfo[10] == "undefined" ? "" : materialInfo[10]);
|
||||
$("#Color").val(materialInfo[3] == "undefined" ? "" : materialInfo[3]);
|
||||
$("#Mfrs").val(materialInfo[20] == "undefined" ? "" : materialInfo[20]);
|
||||
$("#OtherField1").val(materialInfo[21] == "undefined" ? "" : materialInfo[21]);
|
||||
$("#OtherField2").val(materialInfo[22] == "undefined" ? "" : materialInfo[22]);
|
||||
$("#OtherField3").val(materialInfo[23] == "undefined" ? "" : materialInfo[23]);
|
||||
$("#Unit").val(materialInfo[4] == "undefined" ? "" : materialInfo[4]);
|
||||
$("#RetailPrice").val(materialInfo[5] == "undefined" ? "" : materialInfo[5]);
|
||||
$("#LowPrice").val(materialInfo[6] == "undefined" ? "" : materialInfo[6]);
|
||||
$("#PresetPriceOne").val(materialInfo[7] == "undefined" ? "" : materialInfo[7]);
|
||||
$("#PresetPriceTwo").val(materialInfo[8] == "undefined" ? "" : materialInfo[8]);
|
||||
$("#Remark").val(materialInfo[9]);
|
||||
$("#manyUnit").val(materialInfo[16]);
|
||||
if (materialInfo[16] != "undefined") {
|
||||
$("#manyUnitCheck").prop("checked", true);
|
||||
//当前为选中状态
|
||||
$("#Unit").hide();
|
||||
@@ -1390,8 +1335,8 @@
|
||||
firstOptions = firstOptions + basic + other;
|
||||
$("#FirstOutUnit").empty().append('<option value="">(空)</option>').append(firstOptions); //首选出库单位
|
||||
$("#FirstInUnit").empty().append('<option value="">(空)</option>').append(firstOptions); //首选入库单位
|
||||
$("#FirstOutUnit").val(rowsdata.firstoutunit);//首选出库单位
|
||||
$("#FirstInUnit").val(rowsdata.firstinunit);//首选入库单位
|
||||
$("#FirstOutUnit").val(materialInfo[18]);//首选出库单位
|
||||
$("#FirstInUnit").val(materialInfo[19]);//首选入库单位
|
||||
}
|
||||
}
|
||||
else {
|
||||
@@ -1408,7 +1353,7 @@
|
||||
$.ajax({
|
||||
url: '/material/findById',
|
||||
data: {
|
||||
id: rowsdata.id
|
||||
id: materialInfo[0]
|
||||
},
|
||||
type: "get",
|
||||
dataType: "json",
|
||||
@@ -1437,24 +1382,24 @@
|
||||
}
|
||||
});
|
||||
|
||||
oldName = rowsdata.name;
|
||||
oldModel = rowsdata.model;
|
||||
oldColor = rowsdata.color;
|
||||
oldStandard = rowsdata.standard;
|
||||
oldMfrs = rowsdata.mfrs;
|
||||
oldOtherField1 = rowsdata.otherfield1;
|
||||
oldOtherField2 = rowsdata.otherfield2;
|
||||
oldOtherField3 = rowsdata.otherfield3;
|
||||
oldUnit = rowsdata.unit;
|
||||
oldManyUnit = rowsdata.unitid;
|
||||
oldName = materialInfo[1];
|
||||
oldModel = materialInfo[2];
|
||||
oldColor = materialInfo[11];
|
||||
oldStandard = materialInfo[10];
|
||||
oldMfrs = materialInfo[20];
|
||||
oldOtherField1 = materialInfo[21];
|
||||
oldOtherField2 = materialInfo[22];
|
||||
oldOtherField3 = materialInfo[23];
|
||||
oldUnit = materialInfo[4];
|
||||
oldManyUnit = materialInfo[16];
|
||||
$('#materialDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑商品信息');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
materialID = rowsdata.id;
|
||||
materialID = materialInfo[0];
|
||||
//焦点在名称输入框==定焦在输入文字后面
|
||||
$("#Name").val("").focus().val(rowsdata.name);
|
||||
$("#Name").val("").focus().val(materialInfo[1]);
|
||||
//选中基本资料tab
|
||||
$("#materialFM #tt .tabs li").first().click();
|
||||
url = '/material/update?id=' + rowsdata.id;
|
||||
url = '/material/update?id=' + materialInfo[0];
|
||||
}
|
||||
|
||||
|
||||
@@ -1477,12 +1422,6 @@
|
||||
function showMaterialDetails(pageNo, pageSize) {
|
||||
var name = $.trim($("#searchName").val());
|
||||
var model = $.trim($("#searchModel").val());
|
||||
if (setCategoryId != "1") {
|
||||
cid = 2;
|
||||
}
|
||||
else {
|
||||
cid = 1;
|
||||
}
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/material/list",
|
||||
@@ -1491,8 +1430,7 @@
|
||||
search: JSON.stringify({
|
||||
name: name,
|
||||
model: model,
|
||||
categoryId: cid,
|
||||
categoryIds: setCategoryId,
|
||||
categoryIds: types,
|
||||
mpList: mPropertyListShort
|
||||
}),
|
||||
currentPage: pageNo,
|
||||
@@ -1516,8 +1454,9 @@
|
||||
//重置按钮
|
||||
$("#searchResetBtn").unbind().bind({
|
||||
click: function () {
|
||||
$("#searchParentName").val("");
|
||||
$("#searchParentId").val("");
|
||||
$("#searchName").val("");
|
||||
setCategoryId = "1";
|
||||
$("#searchModel").val("");
|
||||
types = ""; //清空类别
|
||||
//加载完以后重新初始化
|
||||
@@ -1595,8 +1534,9 @@
|
||||
}, 3300);
|
||||
});
|
||||
}
|
||||
//查询父级商品类别
|
||||
$("#lookForSelectMaterialCategory").on("click", function () {
|
||||
|
||||
//商品类别选择
|
||||
function materialCategoryDlgFun() {
|
||||
$('#forSelectMaterialCategoryDlg').dialog({
|
||||
title: '商品类别选择',
|
||||
width: webW/2,
|
||||
@@ -1607,6 +1547,16 @@
|
||||
modal: true,
|
||||
resizable:true
|
||||
});
|
||||
}
|
||||
|
||||
//查询父级商品类别
|
||||
$("#lookForSelectMaterialCategory").on("click", function () {
|
||||
clickType = "selectBtn";
|
||||
materialCategoryDlgFun();
|
||||
});
|
||||
$("#lookForMaterialCategory").on("click", function () {
|
||||
clickType = "editBtn";
|
||||
materialCategoryDlgFun();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
@@ -124,17 +124,10 @@
|
||||
{title: '排序', field: 'sort', width: 100},
|
||||
{title: '别名', field: 'anothername', width: 100},
|
||||
{
|
||||
title: '操作', field: 'op', align: "center", width: 80, formatter: function (value, rec,index) {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/6 9:33
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js实现
|
||||
*/
|
||||
title: '操作', field: 'op', align: "center", width: 80, formatter: function (value, rec) {
|
||||
var str = '';
|
||||
// var rowInfo = rec.id + 'AaBb' + rec.nativename + 'AaBb' + rec.enabled + 'AaBb' + rec.sort + 'AaBb' + rec.anothername;
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editMaterialProperty(\'' + index + '\');"/> <a onclick="editMaterialProperty(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
var rowInfo = rec.id + 'AaBb' + rec.nativename + 'AaBb' + rec.enabled + 'AaBb' + rec.sort + 'AaBb' + rec.anothername;
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editMaterialProperty(\'' + rowInfo + '\');"/> <a onclick="editMaterialProperty(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
return str;
|
||||
}
|
||||
}
|
||||
@@ -218,20 +211,19 @@
|
||||
});
|
||||
|
||||
//编辑信息
|
||||
function editMaterialProperty(index) {
|
||||
// var materialPropertyInfo = totalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#nativeName").text(rowsdata.nativename);
|
||||
$("#enabled").attr("checked", rowsdata.enabled == true ? true : false);
|
||||
$("#sort").val(rowsdata.sort);
|
||||
$("#anotherName").val(rowsdata.anothername);
|
||||
function editMaterialProperty(totalInfo) {
|
||||
var materialPropertyInfo = totalInfo.split("AaBb");
|
||||
|
||||
$("#nativeName").text(materialPropertyInfo[1]);
|
||||
$("#enabled").attr("checked", materialPropertyInfo[2] == 'true' ? true : false);
|
||||
$("#sort").val(materialPropertyInfo[3]);
|
||||
$("#anotherName").val(materialPropertyInfo[4]);
|
||||
|
||||
$('#materialPropertyDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑商品属性');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
//焦点在名称输入框==定焦在输入文字后面
|
||||
$("#nativeName").val("").focus().val(rowsdata.nativename);
|
||||
url = '/materialProperty/update?id=' + rowsdata.id;
|
||||
$("#nativeName").val("").focus().val(materialPropertyInfo[1]);
|
||||
url = '/materialProperty/update?id=' + materialPropertyInfo[0];
|
||||
}
|
||||
|
||||
//搜索处理
|
||||
|
||||
@@ -40,188 +40,186 @@
|
||||
</table>
|
||||
<table id="tableForSelectData" style="top:300px;border-bottom-color:#FFFFFF"></table>
|
||||
</div>
|
||||
|
||||
<div id="materialDetailListDlg" class="easyui-dialog" style="width:900px;height:500px;padding:10px 20px" closed="true"
|
||||
modal="true" collapsible="false" closable="true">
|
||||
<table id="materialTableData" style="top:50px;border-bottom-color:#FFFFFF"></table>
|
||||
</div>
|
||||
<script type="text/javascript">
|
||||
var setCategoryId = "1";
|
||||
var cid = 1;
|
||||
//初始化界面
|
||||
$(function () {
|
||||
//初始化系统基础信息
|
||||
initTableData();
|
||||
ininPager();
|
||||
});
|
||||
|
||||
|
||||
//初始化表格数据
|
||||
function initTableData() {
|
||||
//改变宽度和高度
|
||||
$("#searchForSelectPanel").panel({width: webW/2-70});
|
||||
$("#tableForSelectPanel").panel({width: webW/2-70});
|
||||
$('#tableForSelectData').datagrid({
|
||||
//title:'商品列表',
|
||||
//iconCls:'icon-save',
|
||||
//width:700,
|
||||
height: heightInfo,
|
||||
nowrap: false,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate: false,
|
||||
//选中单行
|
||||
singleSelect: true,
|
||||
collapsible: false,
|
||||
selectOnCheck: false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped: true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: initPageSize,
|
||||
pageList: initPageNum,
|
||||
columns: [[
|
||||
{field: 'id', width: 35, align: "center", hidden: true},
|
||||
{title: '品名', field: 'name', width: 150},
|
||||
{title: '型号', field: 'model', width: 100},
|
||||
{title: '类别', field: 'categoryName', width: 130},
|
||||
{title: '单位', field: 'unit', width: 60}
|
||||
]],
|
||||
toolbar: [
|
||||
],
|
||||
onLoadError: function () {
|
||||
$.messager.alert('页面加载提示', '页面加载异常,请稍后再试!', 'error');
|
||||
return;
|
||||
},
|
||||
onDblClickRow : function(rowIndex, rowData){
|
||||
var selectType=$("#selectType").val();
|
||||
console.log(rowData);
|
||||
if(selectType=="lookForSelectMaterial"){
|
||||
//单个添加序列号时选择
|
||||
$("#materialId").val(rowData.id);
|
||||
$("#materialName").val(rowData.name);
|
||||
}else if(selectType=="batLookForSelectMaterial"){
|
||||
//批量添加序列号时选择
|
||||
$("#batAddMaterialName").val(rowData.name);
|
||||
|
||||
}
|
||||
//关闭掉dialog
|
||||
$("#forSelectMaterialDlg").dialog('close');
|
||||
}
|
||||
<script type="text/javascript">
|
||||
var setCategoryId = "1";
|
||||
var cid = 1;
|
||||
//初始化界面
|
||||
$(function () {
|
||||
//初始化系统基础信息
|
||||
initTableData();
|
||||
ininPager();
|
||||
});
|
||||
dgResize();
|
||||
showMaterialDetails(1, initPageSize);
|
||||
}
|
||||
|
||||
|
||||
//初始化表格数据
|
||||
function initTableData() {
|
||||
//改变宽度和高度
|
||||
$("#searchForSelectPanel").panel({width: webW/2-70});
|
||||
$("#tableForSelectPanel").panel({width: webW/2-70});
|
||||
$('#tableForSelectData').datagrid({
|
||||
//title:'商品列表',
|
||||
//iconCls:'icon-save',
|
||||
//width:700,
|
||||
height: heightInfo,
|
||||
nowrap: false,
|
||||
rownumbers: false,
|
||||
//动画效果
|
||||
animate: false,
|
||||
//选中单行
|
||||
singleSelect: true,
|
||||
collapsible: false,
|
||||
selectOnCheck: false,
|
||||
//fitColumns:true,
|
||||
//单击行是否选中
|
||||
//checkOnSelect : false,
|
||||
pagination: true,
|
||||
//交替出现背景
|
||||
striped: true,
|
||||
//loadFilter: pagerFilter,
|
||||
pageSize: initPageSize,
|
||||
pageList: initPageNum,
|
||||
columns: [[
|
||||
{field: 'id', width: 35, align: "center", hidden: true},
|
||||
{title: '品名', field: 'name', width: 150},
|
||||
{title: '型号', field: 'model', width: 100},
|
||||
{title: '类别', field: 'categoryName', width: 130},
|
||||
{title: '单位', field: 'unit', width: 60}
|
||||
]],
|
||||
toolbar: [
|
||||
],
|
||||
onLoadError: function () {
|
||||
$.messager.alert('页面加载提示', '页面加载异常,请稍后再试!', 'error');
|
||||
return;
|
||||
},
|
||||
onDblClickRow : function(rowIndex, rowData){
|
||||
var selectType=$("#selectType").val();
|
||||
console.log(rowData);
|
||||
if(selectType=="lookForSelectMaterial"){
|
||||
//单个添加序列号时选择
|
||||
$("#materialId").val(rowData.id);
|
||||
$("#materialName").val(rowData.name);
|
||||
}else if(selectType=="batLookForSelectMaterial"){
|
||||
//批量添加序列号时选择
|
||||
$("#batAddMaterialName").val(rowData.name);
|
||||
|
||||
|
||||
|
||||
//初始化键盘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 == "CategoryLevel" || obj.id == "Name")) {
|
||||
$("#saveMaterial").click();
|
||||
}
|
||||
//搜索按钮添加快捷键
|
||||
if (k == "13" && (obj.id == "searchCategoryId" || (obj.id == "searchName"))) {
|
||||
$("#searchForSelectBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
//分页信息处理
|
||||
function ininPager() {
|
||||
try {
|
||||
var opts = $("#tableForSelectData").datagrid('options');
|
||||
var pager = $("#tableForSelectData").datagrid('getPager');
|
||||
pager.pagination({
|
||||
onSelectPage: function (pageNum, pageSize) {
|
||||
opts.pageNumber = pageNum;
|
||||
opts.pageSize = pageSize;
|
||||
pager.pagination('refresh',
|
||||
{
|
||||
pageNumber: pageNum,
|
||||
pageSize: pageSize
|
||||
});
|
||||
showMaterialDetails(pageNum, pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
$.messager.alert('异常处理提示', "分页信息异常 : " + e.name + ": " + e.message, 'error');
|
||||
}
|
||||
}
|
||||
//搜索处理
|
||||
$("#searchForSelectBtn").unbind().bind({
|
||||
click: function () {
|
||||
showMaterialDetails(1, initPageSize);
|
||||
var opts = $("#tableForSelectData").datagrid('options');
|
||||
var pager = $("#tableForSelectData").datagrid('getPager');
|
||||
opts.pageNumber = 1;
|
||||
opts.pageSize = initPageSize;
|
||||
pager.pagination('refresh', {
|
||||
pageNumber: 1,
|
||||
pageSize: initPageSize
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function showMaterialDetails(pageNo, pageSize) {
|
||||
var name = $.trim($("#searchForSelectName").val());
|
||||
var model = $.trim($("#searchForSelectModel").val());
|
||||
if (setCategoryId != "1") {
|
||||
cid = 2;
|
||||
}
|
||||
else {
|
||||
cid = 1;
|
||||
}
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/material/getMaterialEnableSerialNumberList",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
search: JSON.stringify({
|
||||
name: name,
|
||||
model: model
|
||||
}),
|
||||
currentPage: pageNo,
|
||||
pageSize: pageSize
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200){
|
||||
if(res.data && res.data.page) {
|
||||
$("#tableForSelectData").datagrid('loadData', res.data.page);
|
||||
}
|
||||
//关闭掉dialog
|
||||
$("#forSelectMaterialDlg").dialog('close');
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
|
||||
return;
|
||||
});
|
||||
dgResize();
|
||||
showMaterialDetails(1, initPageSize);
|
||||
}
|
||||
|
||||
//初始化键盘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 == "CategoryLevel" || obj.id == "Name")) {
|
||||
$("#saveMaterial").click();
|
||||
}
|
||||
//搜索按钮添加快捷键
|
||||
if (k == "13" && (obj.id == "searchCategoryId" || (obj.id == "searchName"))) {
|
||||
$("#searchForSelectBtn").click();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//重置按钮
|
||||
$("#searchForSelectResetBtn").unbind().bind({
|
||||
click: function () {
|
||||
$("#searchForSelectName").val("");
|
||||
setCategoryId = "1";
|
||||
//加载完以后重新初始化
|
||||
$("#searchForSelectBtn").click();
|
||||
//分页信息处理
|
||||
function ininPager() {
|
||||
try {
|
||||
var opts = $("#tableForSelectData").datagrid('options');
|
||||
var pager = $("#tableForSelectData").datagrid('getPager');
|
||||
pager.pagination({
|
||||
onSelectPage: function (pageNum, pageSize) {
|
||||
opts.pageNumber = pageNum;
|
||||
opts.pageSize = pageSize;
|
||||
pager.pagination('refresh',
|
||||
{
|
||||
pageNumber: pageNum,
|
||||
pageSize: pageSize
|
||||
});
|
||||
showMaterialDetails(pageNum, pageSize);
|
||||
}
|
||||
});
|
||||
}
|
||||
catch (e) {
|
||||
$.messager.alert('异常处理提示', "分页信息异常 : " + e.name + ": " + e.message, 'error');
|
||||
}
|
||||
}
|
||||
});
|
||||
//搜索处理
|
||||
$("#searchForSelectBtn").unbind().bind({
|
||||
click: function () {
|
||||
showMaterialDetails(1, initPageSize);
|
||||
var opts = $("#tableForSelectData").datagrid('options');
|
||||
var pager = $("#tableForSelectData").datagrid('getPager');
|
||||
opts.pageNumber = 1;
|
||||
opts.pageSize = initPageSize;
|
||||
pager.pagination('refresh', {
|
||||
pageNumber: 1,
|
||||
pageSize: initPageSize
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
function showMaterialDetails(pageNo, pageSize) {
|
||||
var name = $.trim($("#searchForSelectName").val());
|
||||
var model = $.trim($("#searchForSelectModel").val());
|
||||
if (setCategoryId != "1") {
|
||||
cid = 2;
|
||||
}
|
||||
else {
|
||||
cid = 1;
|
||||
}
|
||||
$.ajax({
|
||||
type: "get",
|
||||
url: "/material/getMaterialEnableSerialNumberList",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
search: JSON.stringify({
|
||||
name: name,
|
||||
model: model
|
||||
}),
|
||||
currentPage: pageNo,
|
||||
pageSize: pageSize
|
||||
}),
|
||||
success: function (res) {
|
||||
if(res && res.code === 200){
|
||||
if(res.data && res.data.page) {
|
||||
$("#tableForSelectData").datagrid('loadData', res.data.page);
|
||||
}
|
||||
}
|
||||
},
|
||||
//此处添加错误处理
|
||||
error: function () {
|
||||
$.messager.alert('查询提示', '查询数据后台异常,请稍后再试!', 'error');
|
||||
return;
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
//重置按钮
|
||||
$("#searchForSelectResetBtn").unbind().bind({
|
||||
click: function () {
|
||||
$("#searchForSelectName").val("");
|
||||
setCategoryId = "1";
|
||||
//加载完以后重新初始化
|
||||
$("#searchForSelectBtn").click();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -46,8 +46,21 @@
|
||||
|
||||
function forSelectMaterialCategory(node) {
|
||||
console.log(node);
|
||||
$("#parentName").val(node.text);
|
||||
$("#parentid").val(node.id);
|
||||
if(clickType) {
|
||||
if(clickType == "selectBtn") {
|
||||
$("#searchParentName").val(node.text);
|
||||
$("#searchParentId").val(node.id);
|
||||
types = "";
|
||||
initMCData(node.id);
|
||||
} else if(clickType == "editBtn") {
|
||||
$("#parentName").val(node.text);
|
||||
$("#parentid").val(node.id);
|
||||
}
|
||||
}
|
||||
else {
|
||||
$("#parentName").val(node.text);
|
||||
$("#parentid").val(node.id);
|
||||
}
|
||||
$('#forSelectMaterialCategoryDlg').dialog('close');
|
||||
}
|
||||
});
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<!--<script src="/js/pages/materials/other_in_list.js"></script>-->
|
||||
<script src="/js/common/jsherp.js"></script>
|
||||
<script src="/js/pages/materials/add_temp.js"></script>
|
||||
<script src="/js/pages/materials/in_out.js"></script>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<!--<script src="/js/pages/materials/other_out_list.js"></script>-->
|
||||
<script src="/js/common/jsherp.js"></script>
|
||||
<script src="/js/pages/materials/add_temp.js"></script>
|
||||
<script src="/js/pages/materials/in_out.js"></script>
|
||||
|
||||
@@ -121,17 +121,10 @@
|
||||
{title: '姓名', field: 'name', width: 180},
|
||||
{title: '类型', field: 'type', width: 180},
|
||||
{
|
||||
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec,index) {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/6 9:33
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js实现
|
||||
*/
|
||||
title: '操作', field: 'op', align: "center", width: 130, formatter: function (value, rec) {
|
||||
var str = '';
|
||||
// var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.type;
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editPerson(\'' + index + '\');"/> <a onclick="editPerson(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.type;
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/pencil.png" style="cursor: pointer;" onclick="editPerson(\'' + rowInfo + '\');"/> <a onclick="editPerson(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">编辑</a> ';
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/edit_remove.png" style="cursor: pointer;" onclick="deletePerson(' + rec.id + ');"/> <a onclick="deletePerson(' + rec.id + ');" style="text-decoration:none;color:black;" href="javascript:void(0)">删除</a> ';
|
||||
return str;
|
||||
}
|
||||
@@ -377,20 +370,19 @@
|
||||
});
|
||||
|
||||
//编辑信息
|
||||
function editPerson(index) {
|
||||
// var personInfo = personTotalInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
$("#Name").val(rowsdata.name);
|
||||
$("#Type").val(rowsdata.type);
|
||||
function editPerson(personTotalInfo) {
|
||||
var personInfo = personTotalInfo.split("AaBb");
|
||||
|
||||
$("#Name").val(personInfo[1]);
|
||||
$("#Type").val(personInfo[2]);
|
||||
|
||||
//oldPerson = personInfo[1];
|
||||
$('#personDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 编辑经手人信息');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
personID = rowsdata.id;
|
||||
personID = personInfo[0];
|
||||
//焦点在名称输入框==定焦在输入文字后面
|
||||
$("#Name").val("").focus().val(rowsdata.name);
|
||||
url = '/person/update?id=' + rowsdata.id;
|
||||
$("#Name").val("").focus().val(personInfo[1]);
|
||||
url = '/person/update?id=' + personInfo[0];
|
||||
}
|
||||
|
||||
//搜索处理
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<!--<script src="/js/pages/materials/purchase_back_list.js"></script>-->
|
||||
<script src="/js/common/jsherp.js"></script>
|
||||
<script src="/js/pages/materials/add_temp.js"></script>
|
||||
<script src="/js/pages/materials/in_out.js"></script>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<!--<script src="/js/pages/materials/purchase_in_list.js"></script>-->
|
||||
<script src="/js/common/jsherp.js"></script>
|
||||
<script src="/js/pages/materials/add_temp.js"></script>
|
||||
<script src="/js/pages/materials/in_out.js"></script>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<!--<script src="/js/pages/materials/purchase_orders_list.js"></script>-->
|
||||
<script src="/js/common/jsherp.js"></script>
|
||||
<script src="/js/pages/materials/add_temp.js"></script>
|
||||
<script src="/js/pages/materials/in_out.js"></script>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<!--<script src="/js/pages/materials/retail_back_list.js"></script>-->
|
||||
<script src="/js/common/jsherp.js"></script>
|
||||
<script src="/js/pages/materials/add_temp.js"></script>
|
||||
<script src="/js/pages/materials/in_out.js"></script>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<!--<script src="/js/pages/materials/retail_out_list.js"></script>-->
|
||||
<script src="/js/common/jsherp.js"></script>
|
||||
<script src="/js/pages/materials/add_temp.js"></script>
|
||||
<script src="/js/pages/materials/in_out.js"></script>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<!--<script src="/js/pages/materials/sale_back_list.js"></script>-->
|
||||
<script src="/js/common/jsherp.js"></script>
|
||||
<script src="/js/pages/materials/add_temp.js"></script>
|
||||
<script src="/js/pages/materials/in_out.js"></script>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<!--<script src="/js/pages/materials/sale_orders_list.js"></script>-->
|
||||
<script src="/js/common/jsherp.js"></script>
|
||||
<script src="/js/pages/materials/add_temp.js"></script>
|
||||
<script src="/js/pages/materials/in_out.js"></script>
|
||||
|
||||
@@ -16,7 +16,6 @@
|
||||
<script src="/js/handlebars.js"></script>
|
||||
<script src="/js/My97DatePicker/WdatePicker.js"></script>
|
||||
<script src="/js/common/common.js"></script>
|
||||
<!--<script src="/js/pages/materials/sale_out_list.js"></script>-->
|
||||
<script src="/js/common/jsherp.js"></script>
|
||||
<script src="/js/pages/materials/add_temp.js"></script>
|
||||
<script src="/js/pages/materials/in_out.js"></script>
|
||||
|
||||
@@ -93,17 +93,10 @@
|
||||
{title: '本月发生额', field: 'thismonthamount', width: 100, align: "center"},
|
||||
{title: '当前余额', field: 'currentamount', width: 100, align: "center"},
|
||||
{
|
||||
title: '操作', field: 'op', width: 100, align: "center", formatter: function (value, rec,index) {
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/5/6 9:33
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 修改效率低下的js实现
|
||||
*/
|
||||
title: '操作', field: 'op', width: 100, align: "center", formatter: function (value, rec) {
|
||||
var str = '';
|
||||
// var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.serialno + 'AaBb' + rec.initialamount + 'AaBb' + rec.currentamount;
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountInOutList(\'' + index + '\');"/> <a onclick="showAccountInOutList(\'' + index + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">流水</a> ';
|
||||
var rowInfo = rec.id + 'AaBb' + rec.name + 'AaBb' + rec.serialno + 'AaBb' + rec.initialamount + 'AaBb' + rec.currentamount;
|
||||
str += '<img src="/js/easyui-1.3.5/themes/icons/list.png" style="cursor: pointer;" onclick="showAccountInOutList(\'' + rowInfo + '\');"/> <a onclick="showAccountInOutList(\'' + rowInfo + '\');" style="text-decoration:none;color:black;" href="javascript:void(0)">流水</a> ';
|
||||
return str;
|
||||
}
|
||||
}
|
||||
@@ -207,12 +200,10 @@
|
||||
});
|
||||
}
|
||||
|
||||
function showAccountInOutList(index) {
|
||||
// var info = accountInfo.split("AaBb");
|
||||
//获取当前行
|
||||
var rowsdata = $("#tableData").datagrid("getRows")[index];
|
||||
var accountId = rowsdata.id;
|
||||
var initialAmount = rowsdata.initialamount;
|
||||
function showAccountInOutList(accountInfo) {
|
||||
var info = accountInfo.split("AaBb");
|
||||
var accountId = info[0];
|
||||
var initialAmount = info[3];
|
||||
$('#accountDetailListDlg').dialog('open').dialog('setTitle', '<img src="/js/easyui-1.3.5/themes/icons/pencil.png"/> 查看账户流水');
|
||||
$(".window-mask").css({width: webW, height: webH});
|
||||
initAccountDetailData(accountId);
|
||||
|
||||
@@ -43,7 +43,7 @@
|
||||
<div class="register-logo">
|
||||
<a href="/">
|
||||
<b>华夏ERP</b>
|
||||
<small>V2.1</small>
|
||||
<small>V1.0</small>
|
||||
</a>
|
||||
</div>
|
||||
<div class="register-box-body">
|
||||
@@ -141,20 +141,13 @@
|
||||
alert("确认密码不一致!");
|
||||
} else {
|
||||
//执行注册
|
||||
/**
|
||||
* create by: qiankunpingtai
|
||||
* create time: 2019/4/24 15:01
|
||||
* website:https://qiankunpingtai.cn
|
||||
* description:
|
||||
* 密码加密后发送到后台
|
||||
*/
|
||||
$.ajax({
|
||||
type: "post",
|
||||
url: "/user/registerUser",
|
||||
dataType: "json",
|
||||
data: ({
|
||||
loginame: $("#username").val(),
|
||||
password: hex_md5($.trim($("#password").val()))
|
||||
password: $("#password").val()
|
||||
}),
|
||||
success: function (res) {
|
||||
if (res && res.code === 200) {
|
||||
|
||||
Reference in New Issue
Block a user