From b08464f75873d75725c685b5ad3ec206fb277b2c Mon Sep 17 00:00:00 2001 From: whycq <123456> Date: 星期五, 09 九月 2022 13:04:42 +0800 Subject: [PATCH] # --- src/main/webapp/static/css/style3.css | 4 src/main/webapp/static/js/projectShow2.js | 1 src/main/webapp/static/js/projectShow3.js | 298 +++++++++++++++++++++++++++++++++++++++++++++++++ src/main/webapp/views/index_datashow3.html | 2 src/main/resources/application.yml | 2 src/main/webapp/static/js/tableData3.js | 2 6 files changed, 304 insertions(+), 5 deletions(-) diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml index c0fc9ae..5f78c24 100644 --- a/src/main/resources/application.yml +++ b/src/main/resources/application.yml @@ -12,7 +12,7 @@ #姝e紡鏁版嵁搴� # url: jdbc:sqlserver://192.168.4.15:1433;databasename=zypms_pro #澶囦唤鏁版嵁搴� - url: jdbc:sqlserver://192.168.4.15:1433;databasename=zypms + url: jdbc:sqlserver://localhost:1433;databasename=zypms username: sa password: sa@123 mvc: diff --git a/src/main/webapp/static/css/style3.css b/src/main/webapp/static/css/style3.css index 04d3bd9..88d4b0f 100644 --- a/src/main/webapp/static/css/style3.css +++ b/src/main/webapp/static/css/style3.css @@ -14,7 +14,7 @@ /* 鐢诲竷 */ #root { /*height: 100%;*/ - /*width: 100%;*/ + width: 100%; /*margin: 0;*/ /*background-color: !* #2C3E50 *! #2e4e7e;*/ position: absolute; @@ -131,7 +131,7 @@ background-color: #FFF; box-shadow: 0px 5px 20px #000; border-radius: 15px; - position: relative; + position: absolute; top:30%; left:35%; display: none; diff --git a/src/main/webapp/static/js/projectShow2.js b/src/main/webapp/static/js/projectShow2.js index 83877a6..7fb6a7e 100644 --- a/src/main/webapp/static/js/projectShow2.js +++ b/src/main/webapp/static/js/projectShow2.js @@ -1,4 +1,5 @@ $(document).on("dblclick",".row",function(){ + console.log('2') var index = $(".row").index(this) // 纭畾鍦ㄨ〃鏍间腑鐨勭鍑犺 var rowName = $(this).children(".projects").html() // 褰撳墠琛屼腑绫诲悕涓簆rojects鐨勭被涓殑鏂囧瓧 var project = data[index] // 鎶奷ata涓殑绗琲ndex涓」鐩� 璧嬪�肩粰project diff --git a/src/main/webapp/static/js/projectShow3.js b/src/main/webapp/static/js/projectShow3.js new file mode 100644 index 0000000..60f42bc --- /dev/null +++ b/src/main/webapp/static/js/projectShow3.js @@ -0,0 +1,298 @@ +$(document).on("dblclick",".row",function(){ + + var index = $(".row").index(this) // 纭畾鍦ㄨ〃鏍间腑鐨勭鍑犺 + console.log('this:'+this,'index:'+index) + var rowName = $(this).children(".projects").html() // 褰撳墠琛屼腑绫诲悕涓簆rojects鐨勭被涓殑鏂囧瓧 + var project = data[index] // 鎶奷ata涓殑绗琲ndex涓」鐩� 璧嬪�肩粰project + if(project.projectName==rowName){ + // 姣旇緝鏃堕棿 + var currT = new Date() // 褰撳墠鏃堕棿 + var staT = new Date(project.projectStartTime.substring(0,10)) // 椤圭洰寮�濮嬫椂闂� + var endT = new Date(project.projectEndTime.substring(0,10)) // 椤圭洰缁撴潫鏃堕棿 + var nodes = project.projectPlans + // 鍒ゆ柇椤圭洰璁″垝鑺傜偣鏃堕棿鏄惁鏈夌┖鍊� + for(var i=0;i<nodes.length;i++){ + if(nodes[i].startTime$==''||nodes[i].endTime$==''){ + show = false + break + }else{ + show = true + } + } + if(show==true){ + $("#details").attr("style","display:block") + }else if(show==false){ + $("#tips").attr("style","display:block") + } + // 椤圭洰鍚嶇О + $("#details h2").html(project.projectName) + // 棰勮鑺傜偣鏃堕棿 + var tab = '' + var tabLeft3 = '' + var day = 86400000 // 涓�澶╂槸 86400000姣 + var days = (endT - staT + day ) / day // 椤圭洰鑺傜偣澶╂暟 + + var bigDays = [] + for(var i = 0;i<nodes.length;i++){ + var projectsName = nodes[i].flowId$ // 鑺傜偣鍚嶇О 鏀圭涓�涓姹傜敤 + var proRET = new Date(nodes[i].realEndTime$.substring(0,10)) // 鑺傜偣瀹為檯缁撴潫鏃堕棿 + var tab2 ='<tr id="td-node'+i+'-gz">'+'<tr id="td-node'+i+'-gz-2">'+'</tr>' + tab = tab +tab2 + var tabLeft2 = '<tr class="tab-body">' + +'<td>'+projectsName+'</td>' + +'<td>'+nodes[i].startTime$.substring(0,10)+'</td>' + +'<td>'+nodes[i].endTime$.substring(0,10)+'</td>' + tabLeft3 = tabLeft3 + tabLeft2 + var overtime = endT-proRET + if(overtime<0){ + bigDays.push(proRET) + } + } + let max = bigDays[0] + for(var i = 0;i<bigDays.length;i++){ + max = max <max[i+1] ? max[i+1] : max + } + var tab1 = + '<thead>' + +'<tr id="th-gz">' + '</tr>' + +'</thead>' + +'<tbody id="tabBody">' + +'<tr id="tot">' +'</tr>' + +'<tr id="tot-2">'+'</tr>' + var tab3 = tab1+tab+'</tbody>' + /* 鐢樼壒鍥惧乏渚� 椤圭洰鍐呭琛� */ + var tabLeft = '<thead>' // 琛ㄥご + +'<tr class="tab-head">' + +'<th>'+'椤圭洰鍚嶇О'+'</th>' + +'<th>'+'寮�濮嬫椂闂�'+'</th>' + +'<th>'+'缁撴潫鏃堕棿'+'</th>' + +'</tr>' + +'</thead>' + +'<tbody>' // 琛ㄨ韩 锛堥」鐩妭鐐瑰鏈級 + +'<tr class="tab-body">' + +'<td style="height: 40px">'+'椤圭洰鎬绘椂闀�'+'</td>' + +'<td style="height: 40px">'+project.projectStartTime.substring(0,10)+'</td>' + +'<td style="height: 40px">'+project.projectEndTime.substring(0,10)+'</td>' + +'</tr>' + + var tabLeft4 = tabLeft + tabLeft3 +'</tbody>' + $("#details-tab-left").empty() + $("#details-tab-left").append(tabLeft4) + $("#details-tab").empty() + $("#details-tab").append(tab3); + // 濉厖鍗曞厓鏍� + var nodeId = ["#tot-2"] + var nodeId4 = [] + for(let k = 0;k<nodes.length;k++){ + var getId = "#"+"td-node"+k+"-gz" + var getId2 = "#"+"td-node"+k+"-gz-2" + nodeId.push(getId) + nodeId.push(getId2) + } + for(let k = 0;k<nodes.length;k++){ + var getId = "#"+"td-node"+k+"-gz" + var getId2 = "#"+"td-node"+k+"-gz-2" + nodeId4.push(getId) + nodeId4.push(getId2) + k++ + } + + if(max>endT){ + days = (max-staT+day)/day + endT=max + getDateArr(staT,endT) + }else{ + getDateArr(staT,endT); + } + let newDataArr = [] + var strr ='' + // 骞翠唤 + if(monthDays.length<2){ // 涓�涓湀 + var gz=monthDays[0]-staT.getDate()+1 // 褰撳墠鏈堜唤鍓╀綑澶╂暟 + stt = '<th class="loadBox" colspan="'+gz+'">'+newMonthArr[0]+'</th>' // 鏈夊灏戝ぉ灏辨í璺ㄥ灏戜釜鏍煎瓙 + $("#th-gz").append(stt) + }else if (monthDays.length<3){ // 涓や釜鏈� + var gz=monthDays[0]-staT.getDate()+1// 褰撳墠鏈堜唤鍓╀綑澶╂暟 + stt = '<th class="loadBox" colspan="'+gz+'">'+newMonthArr[0]+'</th>' // 鏈夊灏戝ぉ灏辨í璺ㄥ灏戜釜鏍煎瓙 + var gz2 = monthDays[1]-(monthDays[1]-endT.getDate()) // 鍓╀綑鐨勫ぉ鏁�=褰撴湀澶╂暟-锛堝綋鏈堝ぉ鏁�-缁撴潫鏃ユ湡锛� + stt2 = '<th class="loadBox" colspan="'+gz2+'">'+newMonthArr[1]+'</th>' + strr =stt +stt2 + $("#th-gz").append(strr) + }else { // 涓変釜鏈堝強浠ヤ笂 + var gz=monthDays[0]-staT.getDate()+1// 褰撳墠鏈堜唤鍓╀綑澶╂暟 + stt = '<th class="loadBox" colspan="'+gz+'">'+newMonthArr[0]+'</th>' // 鏈夊灏戝ぉ灏辨í璺ㄥ灏戜釜鏍煎瓙 + var gz2 = monthDays[monthDays.length-1]-(monthDays[monthDays.length-1]-endT.getDate()) // 鍓╀綑鐨勫ぉ鏁�=褰撴湀澶╂暟-锛堝綋鏈堝ぉ鏁�-缁撴潫鏃ユ湡锛� + stt2 = '<th class="loadBox" colspan="'+gz2+'">'+newMonthArr[newMonthArr.length-1]+'</th>' + // 鍘婚櫎绗竴涓湀 鍜屾渶鍚庝竴涓湀 + monthDays.shift() + monthDays.pop() + newMonthArr.shift() + newMonthArr.pop() + var std = '' + for (var j=0;j<monthDays.length;j++){ + stt3 = '<th class="loadBox" colspan="'+monthDays[j]+'">'+newMonthArr[j]+'</th>' + std = std + stt3 + } + strr = stt + std +stt2 + $("#th-gz").append(strr) + } + // 椤圭洰鏃堕棿鍗曞厓鏍� + for(let i=0;i<days;i++){ + str = '<th class="loadBox-2">'+dateArr[i]+'</th>' + $("#tot").append(str); + // $(".loadBox").attr('style','width:50px') + } + // 鑺傜偣鏃堕棿鍗曞厓鏍� + for (let j=0;j<days;j++){ + tds = '<td class="gz-color'+j+' time-color">'+'</td>' + for(let k in nodeId){ + $(nodeId[k]).append(tds) + } + } + var nodeId2 = [],nodeId3 = [] + for(let k = 0;k<nodes.length;k++){ + var getId2 = "#"+"td-node"+k+"-gz" + var getId3 = "#"+"td-node"+k+"-gz-2" + nodeId2.push(getId2) + nodeId3.push(getId3) + } + for(var i=0;i<nodeId4.length;i++){ + $(nodeId4[i]).attr("style","background:#eeeeef") + } + // for(var j = 0;j < days;j++){ + // $("#tot").find("td").eq(j+3).attr("style","background:#3597D6") + // } + var runDay = Math.ceil((currT - staT)/ day) + if(runDay>0){ + for(var j = 0;j < runDay;j++){ + $("#tot-2").find("td").eq(j).attr("style","background:#8bddde") + } + } + for(var i = 0;i<nodes.length;i++){ + var proST = new Date(nodes[i].startTime$.substring(0,10)) // 璁″垝寮�濮嬫棩鏈� + var proET = new Date(nodes[i].endTime$.substring(0,10)) // 璁″垝缁撴潫鏃ユ湡 + var proET2 = new Date(proET.getTime()-day*2) // 璁″垝缁撴潫鏃ユ湡-2澶� + var proRST =new Date(nodes[i].realStartTime$.substring(0,10)) // 瀹為檯寮�濮嬫棩鏈� + var proRET =new Date(nodes[i].realEndTime$.substring(0,10)) // 瀹為檯缁撴潫鏃ユ湡 + var nodeDay = (proET-proST+day)/day // 璁″垝宸ヤ綔澶╂暟 + var nodeRSDay = (proET-proRST+day)/day // 鑺傜偣瀹為檯宸ヤ綔澶╂暟 + var nodeREDay = (proRET-proST+day)/day // 瀹為檯缁撴潫鍑忚鍒掑紑濮嬫椂闂� + var nodeRealDay = (proRET-proRST+day)/day //瀹為檯鏃堕棿娈� + var intDay = (proST-staT)/day // 棰勮寮�濮嬫椂闂翠笌椤圭洰寮�濮嬫椂闂寸殑闂撮殧 + var intRealDay = (proRST-staT)/day // 瀹為檯寮�濮嬩笌椤圭洰寮�濮嬫椂闂寸殑闂撮殧 + var intRealEndDay = (proRET-staT)/day // 瀹為檯缁撴潫涓庨」鐩紑濮嬬殑闂撮殧 + var nodeRunDay = Math.ceil((currT-proST)/ day) + var nodeRealRunDay = Math.ceil((currT-proRST)/ day) + var nodeRun = Math.ceil((currT-proET-day)/ day) + var notRealStartDay = proRET-(proET-proST) // 鎺ㄧ畻鐨勫疄闄呭紑濮嬫棩鏈� + var intNotRealStartTime = (new Date(notRealStartDay)-staT)/day // 鎺ㄧ畻鐨勫紑濮嬫棩鏈熶笌椤圭洰寮�濮嬫棩鏈熺殑鏃堕棿娈� + + + + // 涓庡綋鍓嶆椂闂寸殑鏃堕棿宸� + for(var j=0;j<nodeDay;j++){ + $(nodeId2[i]).find('td').eq(intDay+j).attr("style","background:#5998f5") + } + // 瀹為檯寮�濮嬫棩鏈熶笌瀹為檯缁撴潫鏃ユ湡閮藉~鍐� 鎸夊疄闄呮椂闂磋繘娓叉煋 + if(proRST != "Invalid Date" && proRET !="Invalid Date"){ + + for(var j=0;j<nodeRealDay;j++){ + if(proRET<=proET2){ // 瀹為檯缁撴潫鏃ユ湡<=璁″垝缁撴潫鏃ユ湡 + $(nodeId3[i]).find('td').eq(intRealDay+j).attr("style","background:#00cc88") + }else if(proRET>proET2 && proRET<=proET){ // 瀹為檯缁撴潫鏃ユ湡>璁″垝缁撴潫鏃ユ湡 + $(nodeId3[i]).find('td').eq(intRealDay+j).attr("style","background:#00cc88") + }else { // 瀹為檯缁撴潫鏃ユ湡>璁″垝缁撴潫鏃ユ湡+2澶� + $(nodeId3[i]).find('td').eq(intRealDay+j).attr("style","background:#e63939") + } + } + // 瀹為檯寮�濮嬫椂闂村凡濉� 瀹為檯缁撴潫鏃堕棿鏈~ (瀹為檯缁撴潫鏃堕棿鎸夐璁$粨鏉熸椂闂村~)鏀� 褰撳墠鏃堕棿涓庡疄闄呭紑濮嬫椂闂寸殑闂撮殧 + }else if(proRST != "Invalid Date" && proRET =="Invalid Date"){ + for(var j=0;j<nodeRealRunDay;j++){ + if(nodeRun>0){ + $(nodeId3[i]).find('td').eq(intRealDay+j).attr("style","background:#CC3333") + }else if(nodeRun>-3 && nodeRun<=0){ + $(nodeId3[i]).find('td').eq(intRealDay+j).attr("style","background:#ccc739") + }else{ + $(nodeId3[i]).find('td').eq(intRealDay+j).attr("style","background:#8bddde") + } + } + // 瀹為檯寮�濮嬫椂闂存湭濉� 瀹為檯缁撴潫鏃堕棿宸插~ 瀹為檯寮�濮嬫椂闂存寜璁″垝寮�濮嬫椂闂� + }else if(proRST == "Invalid Date" && proRET !="Invalid Date"){ + if(proRET<=proST){ // 瀹為檯缁撴潫鏃ユ湡<=璁″垝寮�濮嬫棩鏈� 鏆傛椂涓嶅~鍏� + // for(var j=0;j<nodeDay;j++){ // 澶╂暟鏄妭鐐硅鍒掑ぉ鏁� + // $(nodeId3[i]).find('td').eq(intNotRealStartTime+j).attr("style","background:#49C7D3") // 瀹為檯寮�濮嬫棩鏈熸槸 瀹為檯缁撴潫鏃ユ湡-璁″垝澶╂暟 + // } + }else if(proRET<=proET){ //瀹為檯缁撴潫鏃ユ湡<=璁″垝缁撴潫鏃ユ湡 + for(var j=0;j<nodeREDay;j++) { // 澶╂暟鏄� 瀹為檯缁撴潫鏃ユ湡-璁″垝寮�濮嬫棩鏈� + $(nodeId3[i]).find('td').eq(intDay + j).attr("style", "background:#00cc88")// 瀹為檯寮�濮嬫棩鏈熸槸 瀹為檯缁撴潫鏃ユ湡-璁″垝澶╂暟 + } + }else{ // 瀹為檯缁撴潫鏃ユ湡>璁″垝缁撴潫鏃ユ湡 + for(var j=0;j<nodeREDay;j++) { // 澶╂暟鏄� 瀹為檯缁撴潫鏃ユ湡-璁″垝寮�濮嬫棩鏈� + $(nodeId3[i]).find('td').eq(intDay + j).attr("style", "background:#CC3333")// 瀹為檯寮�濮嬫棩鏈熸槸 瀹為檯缁撴潫鏃ユ湡-璁″垝澶╂暟 + } + } + // 瀹為檯寮�濮嬫椂闂存湭濉� 瀹為檯缁撴潫鏃堕棿鏈~ + }else if(proRST == "Invalid Date" && proRET =="Invalid Date"){ + + } + } + // 榧犳爣缁忚繃 + $(document).on('mouseover','.time-color',function () { + // console.log($(this).attr('class')) + var cls = $(this).attr('class').split(' ')[0] + var cll = '.'+cls + $(cll).addClass('over-color') + }) + // 榧犳爣绂诲紑 + $(document).on('mouseout','.time-color',function () { + // console.log($(this).attr('class')) + var cls = $(this).attr('class').split(' ')[0] + var cll = '.'+cls + $(cll).removeClass('over-color') + }) + // 婊氳疆 + + + + + + + function getDateArr(start,end) { + let option = new Date(start) // 寮�濮嬫椂闂� + let nowDate = new Date(end) // 缁撴潫鏃堕棿 + let times = option.getTime() // 鑾峰彇褰撳墠鏃堕棿鎴�(姣锛� + let ms = (nowDate - option ) / 86400000 // 鐩稿樊鐨勬�诲ぉ鏄殑姣鏁�(澶╂暟) + let days = Math.ceil(ms) // 鍚戜笂鍙栨暣鏁� + dateArr = [] // 鍒涘缓鏃ユ湡鏁扮粍 + monthArr = [] + monthDays=[] + let num = 0 + while (num<=days){ + let needDate = new Date(times) + times += 86400000 // 鍔犱竴澶� + let dayDAY = needDate.getDate(); // 鑾峰彇褰撳墠鏃堕棿鐨勬棩鏈� 1鍙� 2鍙� 3鍙� 4鍙� 绛� + dayDAY = dayDAY<10 ? '0'+dayDAY : dayDAY + dateArr.push(dayDAY) + let month = needDate.getMonth()+1 + month = month<10 ? '0'+month : month + let year = needDate.getFullYear() + yMonth = year+'-'+month + monthArr.push(yMonth) + num++; // 璁℃鐢� + } + function unique (monthArr) { + return Array.from(new Set(monthArr)) + } + newMonthArr = unique(monthArr) + for(var i=0;i<newMonthArr.length;i++){ + s = newMonthArr[i].split("-") + var d = new Date(s[0],s[1],0); + a = d.getDate() + monthDays.push(a) + } + } + } + }) + + + diff --git a/src/main/webapp/static/js/tableData3.js b/src/main/webapp/static/js/tableData3.js index b5cabc2..df4ffa0 100644 --- a/src/main/webapp/static/js/tableData3.js +++ b/src/main/webapp/static/js/tableData3.js @@ -76,7 +76,7 @@ /*****************************************************************************************************************************************************************************/ var getThbodyData = function () { $.ajax({ - url: baseurl + '/pms/projectPlan/toFront/common', + url: baseurl + '/pms/projectPlan/toFront/asrs', type: 'GET', dataType: 'JSON', data: {}, diff --git a/src/main/webapp/views/index_datashow3.html b/src/main/webapp/views/index_datashow3.html index 2a14f99..cb0d86d 100644 --- a/src/main/webapp/views/index_datashow3.html +++ b/src/main/webapp/views/index_datashow3.html @@ -10,7 +10,7 @@ <!-- <script src="../static/js/tableData.js"></script>--> <!-- <script src="../static/js/tableData2.js"></script>--> <script src="../static/js/tableData3.js"></script> - <script src="../static/js/projectShow2.js"></script> + <script src="../static/js/projectShow3.js"></script> <script src="../static/js/cols.js"></script> </head> <body> -- Gitblit v1.9.1