var baseUrl = "https://custproj00011-2.ceydz.com/front"; var token = sessionStorage.getItem("token"); $('#c_portalResPublic_codeContainer-1680865358089 .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 huozhengzuzi = $("#huozhengzuzi").val(); let reportNo = $("#reportNo").val(); let data = { huozhengzuzi, reportNo, }; // console.log("发送数据", data); if (huozhengzuzi == "" || reportNo == "") { layer.msg("请输入信息"); } else { $.ajax({ beforeSend: function(XMLHttpRequest) { XMLHttpRequest.setRequestHeader("token", token); }, type: "get", url: baseUrl + "/wangrui/wentan/getReportList", contentType: "application/json;charset=UTF-8", data: { huozhengzuzi, reportNo, }, 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: '52' }, { field: "huozhengzuzi", title: "获证组织", align: "center", width: '200' }, { field: "reportName", title: "证书/报告名称", align: "center", width: '124' }, { field: "reportNo", title: "证书/报告编号", align: "center", width: '124' }, { field: "guigexinghao", title: "产品名称/规格型号", align: "center", width: '123' }, { field: "renzhengTime", title: "证书/报告时间", align: "center", width: '100',templet: function (row){ return timeFormatter(row.renzhengTime);}}, { field: "reportStatus", title: "证书/报告状态  \n(有效/撤销/其他)", align: "center", width: '130' }, { field: "youxiaoqi", title: "有效期", align: "center", width: '100'}, { field: "jigouName", 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 = { reportNo, huozhengzuzi, status, }; }, }); var html = `

武汉网锐检测温室气体/碳足迹证书信息



查询结果可以手动调节宽度

如对报告有异议,请联系我们

返回首页
`; $(".jc_report").html(html); layuielement(); } // }); // layui table function layuielement() { layui.use("table", function() { let huozhengzuzi = $("#huozhengzuzi").val(); let reportNo = $("#reportNo").val(); var table = layui.table; table.render({ elem: "#jc_table", page: false, url: baseUrl + "/wangrui/wentan/getReportList", //数据接口 method: "get", request: { huozhengzuzi, reportNo, }, headers: { token }, cols: [ [ //表头 field 对应字段 { field: "year", title: "年份", align: "center", width: '52' }, { field: "huozhengzuzi", title: "获证组织", align: "center", width: '200' }, { field: "reportName", title: "证书/报告名称", align: "center", width: '124' }, { field: "reportNo", title: "证书/报告编号", align: "center", width: '124' }, { field: "guigexinghao", title: "产品名称/规格型号", align: "center", width: '123' }, { field: "renzhengTime", title: "证书/报告时间", align: "center", width: '100',templet: function (row){ return timeFormatter(row.renzhengTime);}}, { field: "reportStatus", title: "证书/报告状态  \n(有效/撤销/其他)", align: "center", width: '130' }, { field: "youxiaoqi", title: "有效期", align: "center", width: '100'}, { field: "jigouName", title: "发证机构", align: "center", width: '123' }, ], ], }); }); } function timeFormatter(time) { let split = time.split(' '); var arr = split[0].split('-'); var month = arr[1]; //获取当前日期的月份 var day = arr[2]; //获取当前日期的日 if (month < 10 && month.length == 1) { month = "0"+month; } if (day < 10 && day.length == 1) { day = "0"+day; } return arr[0] + "-" + month + "-" + day; }