From 9c3fbf18d9c3b919206225147d2db7969f59530e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=99=88=E8=A3=95=E8=B4=A2?= Date: Sat, 4 Nov 2023 16:59:05 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BC=98=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/js/util.js | 112 ++++++----- src/components/mdp-ui/js/util.js | 43 +++- .../core/components/MdpSelectUserXm/index.vue | 189 +++++++++--------- src/views/xm/rpt/index/CompsSet.vue | 1 + 4 files changed, 200 insertions(+), 145 deletions(-) diff --git a/src/common/js/util.js b/src/common/js/util.js index b10f196b..d326ac15 100644 --- a/src/common/js/util.js +++ b/src/common/js/util.js @@ -17,12 +17,12 @@ export default { * 通过字典值获取其名称 * 界面上可以 * {{formatDicts(dicts,'xxx',scope.row.xxx)}} - * @param {*} dicts - * @param {*} itemCode - * @param {*} cellValue - * @returns + * @param {*} dicts + * @param {*} itemCode + * @param {*} cellValue + * @returns */ - formatDicts: function(dicts,itemCode,cellValue){ + formatDicts: function(dicts,itemCode,cellValue){ let key=itemCode; if( dicts[key]==undefined || dicts[key]==null || dicts[key].length==0 ){ return cellValue; @@ -32,22 +32,22 @@ export default { return dict.name }else{ return cellValue - } - }, + } + }, /** * 通过字典值获取其名称,返回根值相同的字典,并自动计算其对应显示样式 * 界面上可以类似使用 * 显示: {{item.name}} - + * 下拉框: - + {{item.name}} - + @@ -61,15 +61,15 @@ export default { 7|xx|#ff8c00 8|xx|#c7158577 9|xx|#ffd700 - * - * @param {*} dicts - * @param {*} itemCode - * @param {*} cellValue + * + * @param {*} dicts + * @param {*} itemCode + * @param {*} cellValue * @returns [{id:'',name:'',className:'',color:'',icon:''}] - */ - formatDictsWithClass: function(dicts,itemCode,cellValue){ - - var classNames=['info','primary','success','warning','danger']; + */ + formatDictsWithClass: function(dicts,itemCode,cellValue){ + + var classNames=['info','primary','success','warning','danger']; var colors=['#909399','#409EFF','#67C23A','#E6A23C','#F56C6C','#00ced1','#c71585','#ff8c00','#c7158577','#ffd700']; let key=itemCode; @@ -89,30 +89,30 @@ export default { typeIndex=1 } if(dicts[key]==undefined || dicts[key]==null || dicts[key].length==0 ){ - + return [{id:cellValue,name:cellValue,className:classNames[typeIndex],color:colors[colorIndex]}]; } - let data=dicts[key].find(i=>i.id===cellValue) - if(data){ + let data=dicts[key].find(i=>i.id===cellValue) + if(data){ data['className']=classNames[typeIndex] if(!data.color){ data.color=colors[colorIndex] - } + } return [data]; }else{ return [{id:cellValue,name:cellValue,className:classNames[typeIndex],color:colors[colorIndex]}] } - }, + }, - getColor(cellValue){ + getColor(cellValue){ var colors=['#909399','#409EFF','#67C23A','#E6A23C','#F56C6C','#00ced1','#c71585','#ff8c00','#c7158577','#ffd700']; if(!cellValue){ return colors[0] - } + } var cellValueInt=parseInt(cellValue) if( isNaN(cellValueInt) ){ - + if(cellValue instanceof String && cellValue.length>0){ cellValueInt=cellValue.charCodeAt(cellValue.length-1) }else if(cellValue instanceof Object){ @@ -121,11 +121,11 @@ export default { }else{ cellValueInt=0; } - + }else{ cellValueInt=0; } - + } var colorIndex=cellValueInt % 10 if(cellValueInt > 0 && colorIndex==0){ @@ -134,8 +134,8 @@ export default { return colors[colorIndex] }, - getType(cellValue){ - var classNames=['info','primary','success','warning','danger']; + getType(cellValue){ + var classNames=['info','primary','success','warning','danger']; if(!cellValue){ return classNames[0] @@ -143,30 +143,44 @@ export default { var cellValueInt=parseInt(cellValue) if( isNaN(cellValueInt) ){ cellValueInt=cellValue.charCodeAt(cellValue.length-1) - } + } var typeIndex=cellValueInt % 5 if(cellValueInt > 0 && typeIndex==0){ typeIndex=1 } return classNames[typeIndex] }, - calcTableMaxHeight(cssSelector) { + + calcMaxHeight(cssSelector) { + debugger; var table=cssSelector; if(typeof cssSelector == 'string'){ table=document.querySelector(cssSelector); + } + var innerHeight=window.innerHeight + var top=150; + + + if(table!=null){ + var rect=table.getBoundingClientRect() + + if(rect && rect.top){ + top=rect.top; + } } + var maxTableHeight =innerHeight-top; + return maxTableHeight; + }, + calcTableMaxHeight(cssSelector) { + var table=cssSelector; + if(typeof cssSelector == 'string'){ + table=document.querySelector(cssSelector); + } var innerHeight=window.innerHeight - var defaultInnerHeight=616; - var pageHeight=32/defaultInnerHeight*innerHeight - var top=150/defaultInnerHeight*innerHeight; - var bottomHeight=36/defaultInnerHeight*innerHeight - if(innerHeight>=916){ - bottomHeight=20/defaultInnerHeight*innerHeight - }else if(innerHeight>=800){ - bottomHeight=26/defaultInnerHeight*innerHeight - }else if(innerHeight>=700){ - bottomHeight=32/defaultInnerHeight*innerHeight - } + var pageHeight=32 + var top=150; + var bottomHeight=24 + if(table!=null){ var rect=table.getBoundingClientRect() @@ -177,13 +191,13 @@ export default { var maxTableHeight =innerHeight-top-pageHeight-bottomHeight; return maxTableHeight; }, - getPositionTop(node) { + getPositionTop(node) { if(!node){ return 0; - } - var rect=node.getBoundingClientRect() - var top=rect.top; + } + var rect=node.getBoundingClientRect() + var top=rect.top; if(top==0){ return 0; } @@ -300,7 +314,7 @@ export default { */ toLine(name) { return name.replace(/([A-Z])/g, "_$1").toLowerCase(); - }, + }, formatDate: function(date, pattern) { pattern = pattern || DEFAULT_PATTERN return pattern.replace(SIGN_REGEXP, function($0) { @@ -356,7 +370,7 @@ export default { return _date } return null - }, + }, //type date/daterange getPickerOptions: function(type) { diff --git a/src/components/mdp-ui/js/util.js b/src/components/mdp-ui/js/util.js index 30faa936..9e4abfd5 100644 --- a/src/components/mdp-ui/js/util.js +++ b/src/components/mdp-ui/js/util.js @@ -398,5 +398,46 @@ export default { // 防止反复添加 if(!document.getElementById(id)) document.body.appendChild(a); a.click(); - } + }, + + calcMaxHeight:function(cssSelector) { + debugger; + var table=cssSelector; + if(typeof cssSelector == 'string'){ + table=document.querySelector(cssSelector); + } + var innerHeight=window.innerHeight + var top=150; + + + if(table!=null){ + var rect=table.getBoundingClientRect() + + if(rect && rect.top){ + top=rect.top; + } + } + var maxTableHeight =innerHeight-top; + return maxTableHeight; + }, + calcTableMaxHeight:function(cssSelector) { + var table=cssSelector; + if(typeof cssSelector == 'string'){ + table=document.querySelector(cssSelector); + } + var innerHeight=window.innerHeight + var pageHeight=32 + var top=150; + var bottomHeight=24 + + + if(table!=null){ + var rect=table.getBoundingClientRect() + if(rect && rect.top!=0){ + top=rect.top; + } + } + var maxTableHeight =innerHeight-top-pageHeight-bottomHeight; + return maxTableHeight; + }, } diff --git a/src/views/xm/core/components/MdpSelectUserXm/index.vue b/src/views/xm/core/components/MdpSelectUserXm/index.vue index faca48e7..de900f18 100644 --- a/src/views/xm/core/components/MdpSelectUserXm/index.vue +++ b/src/views/xm/core/components/MdpSelectUserXm/index.vue @@ -1,90 +1,90 @@ -