Files
erp-site/statics/js/dist/paymentList.js
2026-04-19 01:39:41 +08:00

275 lines
8.3 KiB
JavaScript
Executable File

var queryConditions = {
matchCon: ""
},
SYSTEM = parent.SYSTEM,
//VERSION = parent.SYSTEM.siType,
VERSION = 1,
billRequiredCheck = 0,
//billRequiredCheck = system.billRequiredCheck,
THISPAGE = {
init: function(a) {
this.mod_PageConfig = Public.mod_PageConfig.init("paymentList"), this.initDom(), this.loadGrid(), this.addEvent()
},
initDom: function() {
this.$_matchCon = $("#matchCon"), this.$_beginDate = $("#beginDate").val(SYSTEM.beginDate), this.$_endDate = $("#endDate").val(SYSTEM.endDate), this.$_matchCon.placeholder(), this.$_beginDate.datepicker(), this.$_endDate.datepicker()
},
loadGrid: function() {
function a(a, b, c) {
var d = '<div class="operating" data-id="' + c.id + '"><span class="ui-icon ui-icon-pencil" title="修改"></span><span class="ui-icon ui-icon-trash" title="删除"></span></div>';
return d
}
var b = $(window).height() - $(".grid-wrap").offset().top - 65,
c = this,
d = [{
name: "operating",
label: "操作",
width: 60,
fixed: !0,
formatter: a,
align: "center"
}, {
name: "billDate",
label: "单据日期",
index: "billDate",
width: 100,
align: "center"
}, {
name: "billNo",
label: "单据编号",
index: "billNo",
width: 120,
align: "center"
}, {
name: "contactName",
label: "购货单位",
index: "contactName",
width: 200
}, {
name: "amount",
label: "付款金额",
index: "amount",
width: 100,
align: "right",
formatter: "currency"
}, {
name: "checkName",
label: "审核人",
index: "checkName",
width: 80,
hidden: billRequiredCheck ? !1 : !0,
fixed: !0,
align: "center",
title: !0,
classes: "ui-ellipsis"
}, {
name: "userName",
label: "制单人",
index: "userName",
width: 80,
fixed: !0,
align: "center",
title: !0,
classes: "ui-ellipsis"
}];
switch (VERSION) {
case 1:
break;
case 2:
d = d.concat([{
name: "bDeAmount",
label: "本次核销金额",
index: "hxAmount",
width: 100,
align: "right",
formatter: "currency"
}, {
name: "adjustRate",
label: "整单折扣",
index: "adjustRate",
width: 100,
align: "right",
formatter: "currency"
}, {
name: "deAmount",
label: "本次预付款",
index: "deAmount",
width: 100,
align: "right",
formatter: "currency"
}])
}
d.push({
name: "description",
label: "备注",
index: "description",
width: 200,
classes: "ui-ellipsis"
}), queryConditions.beginDate = this.$_beginDate.val(), queryConditions.endDate = this.$_endDate.val(), c.markRow = [], this.mod_PageConfig.gridReg("grid", d), d = this.mod_PageConfig.conf.grids.grid.colModel, $("#grid").jqGrid({
url: "../scm/payment?action=list",
postData: queryConditions,
datatype: "json",
autowidth: !0,
height: b,
altRows: !0,
rownumbers: !0,
gridview: !0,
colModel: d,
cmTemplate: {
sortable: !1,
title: !1
},
multiselect: !0,
page: 1,
sortname: "number",
sortorder: "desc",
pager: "#page",
rowNum: 2e3,
rowList: [300, 500, 1e3],
scroll: 1,
loadonce: !0,
viewrecords: !0,
shrinkToFit: !1,
forceFit: !0,
jsonReader: {
root: "data.rows",
records: "data.records",
repeatitems: !1,
id: "id"
},
loadComplete: function(a) {
var b = c.markRow.length;
if (b > 0) for (var d = 0; b > d; d++) $("#" + c.markRow[d]).addClass("red")
},
loadError: function(a, b, c) {},
ondblClickRow: function(a, b, c, d) {
$("#" + a).find(".ui-icon-pencil").trigger("click")
},
resizeStop: function(a, b) {
THISPAGE.mod_PageConfig.setGridWidthByIndex(a, b - 1, "grid")
}
}).navGrid("#page", {
edit: !1,
add: !1,
del: !1,
search: !1,
refresh: !1
}).navButtonAdd("#page", {
caption: "",
buttonicon: "ui-icon-config",
onClickButton: function() {
THISPAGE.mod_PageConfig.config()
},
position: "last"
})
},
reloadData: function(a) {
this.markRow = [], $("#grid").jqGrid("setGridParam", {
url: "../scm/payment?action=list",
datatype: "json",
postData: a
}).trigger("reloadGrid")
},
addEvent: function() {
var a = this;
if ($(".grid-wrap").on("click", ".ui-icon-pencil", function(a) {
a.preventDefault();
var b = $(this).parent().data("id");
parent.tab.addTabItem({
tabid: "money-payment",
text: "付款单",
url: "../scm/payment?action=editPay&id=" + b
});
$("#grid").jqGrid("getDataIDs");
parent.paymentListIds = $("#grid").jqGrid("getDataIDs")
}), $(".grid-wrap").on("click", ".ui-icon-trash", function(a) {
if (a.preventDefault(), Business.verifyRight("PAYMENT_DELETE")) {
var b = $(this).parent().data("id");
$.dialog.confirm("您确定要删除该付款记录吗?", function() {
Public.ajaxGet("../scm/payment/delete?action=delete", {
id: b
}, function(a) {
200 === a.status ? ($("#grid").jqGrid("delRowData", b), parent.Public.tips({
content: "删除成功!"
})) : parent.Public.tips({
type: 1,
content: a.msg
})
})
})
}
}), $("#search").click(function() {
queryConditions.matchCon = "请输入单据号或供应商或备注" === a.$_matchCon.val() ? "" : a.$_matchCon.val(), queryConditions.beginDate = a.$_beginDate.val(), queryConditions.endDate = a.$_endDate.val(), THISPAGE.reloadData(queryConditions)
}), $("#refresh").click(function() {
THISPAGE.reloadData(queryConditions)
}), $("#add").click(function(a) {
a.preventDefault(), Business.verifyRight("PAYMENT_ADD") && parent.tab.addTabItem({
tabid: "money-payment",
text: "付款单",
url: "../scm/payment?action=initPay"
})
}), billRequiredCheck) {
$("#audit").css("display", "inline-block"), $("#reAudit").css("display", "inline-block");
$(".wrapper").on("click", "#audit", function(a) {
if (a.preventDefault(), Business.verifyRight("PAYMENT_CHECK")) {
var b = $("#grid").jqGrid("getGridParam", "selarrrow"),
c = b.join();
return c ? void Public.ajaxPost("../scm/payment/batchCheckPayment?action=batchCheckPayment", {
id: c
}, function(a) {
200 === a.status ? parent.Public.tips({
content: a.msg
}) : parent.Public.tips({
type: 1,
content: a.msg
}), $("#search").trigger("click")
}) : void parent.Public.tips({
type: 2,
content: "请先选择需要审核的项!"
})
}
}), $(".wrapper").on("click", "#reAudit", function(a) {
if (a.preventDefault(), Business.verifyRight("PAYMENT_UNCHECK")) {
var b = $("#grid").jqGrid("getGridParam", "selarrrow"),
c = b.join();
return c ? void Public.ajaxPost("../scm/payment/rsbatchCheckPayment?action=rsbatchCheckPayment", {
id: c
}, function(a) {
200 === a.status ? parent.Public.tips({
content: a.msg
}) : parent.Public.tips({
type: 1,
content: a.msg
}), $("#search").trigger("click")
}) : void parent.Public.tips({
type: 2,
content: "请先选择需要反审核的项!"
})
}
})
}
$(".wrapper").on("click", "#print", function(a) {
a.preventDefault(), Business.verifyRight("PAYMENT_PRINT") && Public.print({
title: "付款单打印",
$grid: $("#grid"),
pdf: "../scm/payment/toPdf?action=toPdf",
billType: 10602,
filterConditions: queryConditions
})
}), $("#export").click(function(a) {
if (!Business.verifyRight("PAYMENT_EXPORT")) return void a.preventDefault();
var b = $("#grid").jqGrid("getGridParam", "selarrrow"),
c = b.join(),
d = c ? "&id=" + c : "";
for (var e in queryConditions) queryConditions[e] && (d += "&" + e + "=" + queryConditions[e]);
var f = "../scm/payment/export?action=export" + d;
$(this).attr("href", f)
}), $(window).resize(function() {
Public.resizeGrid()
})
}
};
$(function() {
THISPAGE.init()
});