Files

2 lines
5.3 KiB
JavaScript
Raw Permalink Normal View History

2025-11-25 17:41:24 +08:00
function gotoDetailPartialNew(id){$("#pPlanInterBox_Content").empty();removePPInfo();$.ajax({url:"/APP/PPlan/PPlanInternalDetailsNew",type:"post",data:{"id":id},dataType:"json",success:function(res){if(res.Status==200){setPPInfo(res);if(res.Data.rows){var jsonArray=res.Data.rows;var headArray=[];for(var i in jsonArray[0]){headArray[headArray.length]=i}var div=document.getElementById("pPlanInterBox_Content");var table=document.createElement("table");table.id="new_table";table.setAttribute("class","table table-striped table-bordered table-hover dataTables-example");var theadH=document.createElement("thead");var thead=document.createElement("tr");for(var count=1;count<headArray.length;count++){var td=document.createElement("th");td.innerHTML=headArray[count];thead.appendChild(td)}theadH.appendChild(thead);table.appendChild(theadH);var theadY=document.createElement("tbody");for(var tableRowNo=0;tableRowNo<jsonArray.length;tableRowNo++){var tr=document.createElement("tr");for(var headCount=1;headCount<headArray.length;headCount++){var cell=document.createElement("td");cell.setAttribute("class",jsonArray[tableRowNo][headArray[0]]+" "+headArray[headCount]);cell.innerHTML=jsonArray[tableRowNo][headArray[headCount]];cell.dataset.station=headArray[headCount];cell.dataset.datetime=jsonArray[tableRowNo][headArray[1]];tr.appendChild(cell)}theadY.appendChild(tr);table.appendChild(theadY)}div.appendChild(table);newTable(table.id);$(".ToDay.Date").css({"border-bottom":"1px solid #FFF"});$(".Total").css({"border-bottom":"1px solid #333"});$(".Total:not(.Date)").css({"font-weight":"600","font-style":"italic"})}else{$("#pPlanInterBox_Content").html("<small><strong> 暂无生产计划</strong ></small >")}}},})}function mergeCell(table1,startRow,endRow,col){var tb=document.getElementById(table1);if(!tb||!tb.rows||tb.rows.length<=0){return}if(col>=tb.rows[0].cells.length||(startRow>=endRow&&endRow!=0)){return}if(endRow==0){endRow=tb.rows.length-1}for(var i=startRow;i<endRow;i++){if(tb.rows[startRow].cells[col].innerHTML==tb.rows[i+1].cells[col].innerHTML){tb.rows[i+1].removeChild(tb.rows[i+1].cells[col]);tb.rows[startRow].cells[col].rowSpan=(tb.rows[startRow].cells[col].rowSpan)+1}else{mergeCell(table1,i+1,endRow,col);break}}}var oTable;function newTable(tbid){oTable=$("#"+tbid).DataTable({"bFilter":false,"info":false,"ordering":false,"lengthChange":false,"bAutoWidth":false,"bPaginate":false,});oTable.$("td:not(.Date,.Total,.DataType)").editable(function(value,settings){var station=this.dataset.station;var datetime=this.dataset.datetime;var oiID=$("#oiID").val();var projectID=$("#projectID").val();SetPPCount(projectID,oiID,station,datetime,value);return(value)},{"indicator":"保存中...","tooltip":"单击编辑...","width":"60px","height":"100%","placeholder":"0",});$.editable.addInputType("birthday",{element:function(settings,original){var input=$('<input type="text" size="8" readonly>').datetimepicker({language:"zh-CN",format:"yyyy-mm-dd",autoclose:1,startView:2,minView:2,});$(this).append(input);return(input)}});oTable.$(".Date:not(.Total)").editable(function(value,settings){var datetime=this.dataset.datetime;var oiID=$("#oiID").val();var projectID=$("#projectID").val();SetPPDate(projectID,oiID,datetime,value);return(value)},{"indicator":"保存中...","tooltip":"单击编辑...","width":"60px","height":"100%","placeholder":"0","type":"birthday","onblur":"submit",})}function setPPInfo(res){$("#customerAbbr").html(res.Data.CustomerAbbr);$("#projectName").html(res.Data.ProjectName);$("#orderNo").html(res.Data.OrderNo);$("#internalNo").html(res.Data.InternalNo);$("#deliveryTime").html(res.Data.DeliveryTimeStr);$("#stationText").html(res.Data.StationText);$("#oiID").val(res.Data.ID);$("#projectID").val(res.Data.ProjectID);$("#ppInfo").attr("style","display:block;")}function removePPInfo(){$("#customerAbbr").html("");$("#projectName").html("");$("#orderNo").html("");$("#internalNo").html("");$("#deliveryTime").html("");$("#stationText").html("");$("#oiID").val("");$("#projectID").val("");$("#ppInfo").attr("style","display:none;")}function
gotoDetailPartialNew(oiID)}else{$.toastr.error("提交失败! <br />"+res.Message,{time:3000,position:"top-center"})}}})};