Explorar o código

统一功图相关参数,统一实时参数表格

chenwen hai 1 ano
pai
achega
8a6d00040c

+ 3 - 1
src/components/diagram/lib/diagram.js

@@ -120,6 +120,7 @@ Diagram.prototype={
 	//{base:{type:,xTitle:,yTitle:,title,xUnit,yUnit,xyAxisRatio,yFixedMin,yFixedMax},serial:{smpTime,xvals,yvals},descTxt}
 		
 		let {type='GT',xTitle='',yTitle='',title='',xyAxisRatio=2,yFixedMin,yFixedMax,xUnit,yUnit}=diagramData.base||{}
+		let {upMax,downMax,glbMax,glbMin,balance,stroke,turnIndex}=diagramData.base||{}
 		this.xTitle=xTitle
 		this.yTitle=yTitle
 		this.title=title
@@ -127,7 +128,8 @@ Diagram.prototype={
 		
 		//构建曲线对象
 		let line=new Line({type,xUnit,yUnit,smpTime:diagramData.serial.smpTime});
-		line.setData(diagramData.serial.xvals,diagramData.serial.yvals)
+		//line.setData(diagramData.serial.xvals,diagramData.serial.yvals)
+		line.initData(diagramData.serial.xvals,diagramData.serial.yvals,{upMax,downMax,glbMax,glbMin,balance,stroke,turnIndex})
 		this.yMax=yFixedMax!=null?yFixedMax:line.yMax;  //优先使用设置的固定值,后使用计算出的值
 		this.yMin=yFixedMin!=null?yFixedMin:line.yMin;
 		this.xMax=line.xMax;

+ 39 - 0
src/components/diagram/lib/line.js

@@ -30,6 +30,45 @@ function Line(opts){
 }
 
 Line.prototype={
+	initData:function(xVals,yVals,extraObj){
+		this.xProjs=xVals;
+		this.yProjs=yVals;
+		
+		this.yMax=extraObj.glbMax;
+		this.yMin=extraObj.glbMin;
+		this.xMax=extraObj.stroke;
+		this.xMin=0;
+		
+		
+		this.datas=[];
+		this.datas.push([xVals[0],yVals[0]]);
+		for (var i=1,len=xVals.length,len2=yVals.length;i<len&&i<len2;i++ ) {
+			this.datas.push([xVals[i],yVals[i]]);
+		}
+			 
+		//闭合曲线
+		this.datas.push([xVals[0],yVals[0]]);
+		
+		//确定上下行
+		this.startUp = (this.xMax- this.xProjs[0]) > (this.xProjs[0] - this.xMin);
+		if (this.startUp) {
+			this.colorAry=[this.upColor,this.downColor];
+		}
+		else {
+			this.colorAry=[this.downColor,this.upColor]; 
+		}
+		this.turnIndex=extraObj.turnIndex;
+		
+		//平衡度
+		this.balance=extraObj.balance;
+		
+		//上下行最大
+		this.yUpMaxProj=extraObj.upMax;
+		this.yDownMaxProj=extraObj.downMax;
+		
+		//冲程
+		this.stroke=extraObj.stroke;
+	},
 	setData:function(xVals,yVals){
 		this.xProjs=xVals;
 		this.yProjs=yVals;

+ 21 - 3
src/pages/single/WellPatrolParams.vue

@@ -16,7 +16,7 @@
 				      </template>
 				</el-dropdown>
 			</div>	
-			<div class="param-block" v-for="(param,index) in tabParams" @contextmenu="showCtxMenu($event,param)">
+			<div class="param-block" v-for="(param,index) in listParams" @contextmenu="showCtxMenu($event,param)">
 			  <div class="param-tit">{{param.paramName}}</div>
 			  <div class="param-val" :class="{'param-val-alarm':patrolAlarm[param.paramCode]}"  :title="patrolAlarm[param.paramCode]?.alarmDesc">{{patrolData[param.paramCode]}}</div>
 			  <div class="param-unit" v-if="param.displayUnit&&param.displayUnit!='空'">{{param.displayUnit}}</div>
@@ -162,6 +162,7 @@
 	}
 	
 	const tabParams = ref([])
+	const listParams =ref([])
 	
 	const  tabQueryHandle=()=>{
 		crudTable.value.query({wellId:crtWell.id})
@@ -219,6 +220,7 @@
 	const loadWellParam=(wellId)=>{
 		resetPage()
 		
+		//动态参数获取
 		wellPatrolAPI.loadWellDynParamTemp(wellId).then(resp=>{
 			//console.log(resp)
 			if(resp.code!=0){
@@ -235,10 +237,10 @@
 				param.displayUnit=unitMap[param.paramCode]||''
 			})
 			
-			tabParams.value=tempDtl
+			listParams.value=tempDtl
 			
 			nextTick(()=>{
-				tabQueryHandle()
+				//tabQueryHandle()
 				loadData(wellId)
 				timeLoader=setInterval(()=>{loadData(wellId)},30000)
 			})
@@ -248,6 +250,22 @@
 		})
 		
 		
+		//历史参数表格
+		wellParamAPI.loadWellParam(wellId).then(resp=>{
+			
+			if(resp.code!=0){
+				ElMessage.error(resp.msg||'获取井参数失败')
+				return
+			}
+			tabParams.value = resp.data.filter(param=>param.paramCode.indexOf('diagram')<0)
+			
+			nextTick(()=>{
+				tabQueryHandle()
+			})
+		}).catch(err=>{
+			
+		})
+		
 	}
 	
 	const store=useHomeStore()