var baseUrl = "https://custproj00011-2.ceydz.com/front"; var token = sessionStorage.getItem("token"); $('#c_portalResPublic_codeContainer-16420386248644878 .jc_report').css({ 'background': 'url("../img/beijing1.jpg") no-repeat center', 'background-size': 'cover', 'height': document.documentElement.clientHeight + 'px' }) $(document).ready(function() { // 判断是否登陆 }); //点击查询 $(".jc_reportbtn").click(function() { let unit = $("#jc_client").val(); let report = $("#jc_reportId").val(); let data = { unit, report, }; // console.log("发送数据", data); if (unit == "" || report == "") { layer.msg("请输入信息"); } else { $.ajax({ beforeSend: function(XMLHttpRequest) { XMLHttpRequest.setRequestHeader("token", token); }, type: "get", url: baseUrl + "/wangrui/getReportList", contentType: "application/json;charset=UTF-8", data: { unit, report, }, success: (res) => { // console.log("成功了", res); var table = layui.table; table.render({ elem: "#jc_table", data: res.content, cols: [ [ //表头 field 对应字段 { field: "year", title: "年份", align: "center", width: '62' }, { field: "unit", title: "委托单位", align: "center", width: '200' }, { field: "report", title: "报告/证书编号", align: "center", width: '124' }, { field: "proName", title: "产品名称", align: "center", width: '124' }, { field: "proModel", title: "产品型号", align: "center", width: '123' }, ], ], }); }, error: (err) => { // console.log("失败了", err); layer.msg("失败", { icon: 2, }); }, complete: (xml) => { const contentLength = xml.responseJSON.content.length; let status = ""; if (contentLength == 0) { status = 1; } else { status = 0; } const rzForm = { report, unit, status, }; const sendRZform = JSON.stringify(rzForm); $.ajax({ beforeSend: function(XMLHttpRequest) { XMLHttpRequest.setRequestHeader("token", token); }, type: "post", contentType: "application/json;charset=UTF-8", url: baseUrl + "/wangrui/addSearch", data: sendRZform, success: function(res) {}, error: function(e) {}, }); }, }); var html = `