JS中的JSON过滤方法filter
2021-02-02 14:14
标签:ram url int() button dcl empty outer 定义 contain JS中的JSON过滤方法filter 标签:ram url int() button dcl empty outer 定义 contain 原文地址:https://www.cnblogs.com/jiangyunfeng/p/13169424.html// 打印所有
function onAllButtonClick() {
$("#print div div:contains(‘项目号:‘)").html(‘项目号:‘ + F.ui.lbItem_no.getText());
$("#print div div:contains(‘内部合同号:‘)").html(‘内部合同号:‘ + F.ui.lbContract_i_no.getText());
$("#print div div:contains(‘收货单位‘)").html(‘收货单位:‘ + F.ui.customerName.getText());
$("#print div div:contains(‘工程:‘)").html(‘工程:‘ + F.ui.Project_name.getText());
var oldstr = $("#print > div").prop("outerHTML");
var temp = $("#print").find("div").prop("outerHTML");
$("#print").empty();
var list = F.ui.ddlNumber.data;
//打印所有 每个柜号 的条形码不一样
F.doPostBack({
url: ‘@Url.Action("InvoicesBarCodeMore")‘,
fields: ‘ddlNumber,hfPlanOrdersID,ddlContract_i_no‘,
params: {
list: F.toJSON(list)
},
complete: function (data) {
data = JSON.parse(data);
if (data.length>0) {
for (var i = 0; i ) {
$("#print").append(temp);
$("#print>div:eq(" + i + ") div:contains(‘本批货物共‘)").html(F.ui.Plat_number2.getText() + ‘ 第‘ + list[i].text + ‘件 柜号‘ + list[i].text);
var urlimageData = data.filter((p) => {
return p.containerNumber == list[i].text;
});
//字符串进行拆分
var urlimageDataArr = new Array(); //定义一数组
urlimageDataArr = urlimageData[0].productNameAndClientItem.split(","); //字符分割
$("#print>div:eq(" + i + ")").find(‘div[class="productName"]‘).html(‘柜型:‘ + urlimageDataArr[0]);
$("#print>div:eq(" + i + ")").find(‘div[class="clientItem"]‘).html(‘客户料号:‘ + urlimageDataArr[1]);
}
$(‘#print‘).print();
$("#print").html(oldstr);
}
}
});
}
下一篇:.net发送HTTP请求