Преглед изворни кода

增加由当前功图转为模板功图功能

chenwen пре 1 година
родитељ
комит
9efdf725ef

+ 16 - 0
src/api/diagnoseStandard.js

@@ -62,5 +62,21 @@ api.diagnoseOut = (reqData) => {
 	    });
 }
 
+api.startDiagnose = (reqData) => {
+	    return request({
+	        url: '/diagnose/standard/startDiagnose',
+	        method: 'post',
+			data:reqData
+	    });
+}
+
+api.convert2TempDiagram = (reqData) => {
+	    return request({
+	        url: '/diagnose/standard/convert2TempDiagram',
+	        method: 'post',
+			data:reqData
+	    });
+}
+
 
 export  default api

+ 3 - 0
src/components/diagram/Diagram.vue

@@ -128,6 +128,9 @@
 		},
 		drawThoeryLine:(y1,y2)=>{
 			diagram.drawThoeryLine(y1,y2)
+		},
+		showOnlyCurve:()=>{
+			diagram.showOnlyCurve()
 		}
 	})
 	

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

@@ -9,6 +9,7 @@ function Diagram(id,opts){
 	this.options=opts;
 	//this.type=null;
 	this.stage=null;
+	this.bglayer=null;
 	this.diagramShape=null;
 	this.curveShape=null;
 	this.mask=null;
@@ -62,13 +63,18 @@ Diagram.prototype={
 		 me.stage.update();
 	    });
 	    
-	   
+		//底图
+		this.bglayer=new createjs.Shape();
+		this.stage.addChild(this.bglayer);
+		this.bglayer.visible=false;
+		this.bglayer.graphics.beginFill("#ffffff").drawRect(0,0,this.canvasW,this.canvasH);
 	    
 	    //创建坐标画布
 	    this.diagramShape= new createjs.Shape();
 	    this.stage.addChild(this.diagramShape);
 	    
 	    //创建曲线画布
+		
 	    this.curveShape= new createjs.Shape();
 	    this.stage.addChild(this.curveShape);
 		
@@ -349,6 +355,14 @@ Diagram.prototype={
 	    
 	},
 	
+	showOnlyCurve:function(){
+		var tag=this.diagramShape.visible;
+		this.diagramShape.visible=!tag;
+		this.markLineLayer.visible=!tag;
+		this.txtBox.visible=!tag;
+		this.bglayer.visible=tag;
+	},
+	
 	getX:function(d){
 		return this.origin.x+(d-this.xMin)*this.xratio;
 		//window.console.log("x:"+ret);

+ 1 - 1
src/pages/analysis/DiagnoseStandard.vue

@@ -37,7 +37,7 @@
 				  <el-table-column prop="pumpDownBump" label="下行碰泵程度" width="160" />
 				  <el-table-column prop="pistonSlipDegree" label="活塞脱出程度" width="160" />
 				  <el-table-column prop="conclusion" label="诊断结论" width="200"/>
-				  <el-table-column prop="advise" label="建议措施" width="260" show-overflow-tooltip="true"/>
+				  <el-table-column prop="advise" label="建议措施" width="260" :show-overflow-tooltip="true"/>
 				  <el-table-column prop="oper" label="操作" width="160" fixed="right">
 				  					<template #default="scope">
 				  						<div class="tool-column">

+ 59 - 1
src/pages/analysis/DiagramFeatureExt.vue

@@ -9,7 +9,9 @@
 				<template #header>
 				    <div class="card-header" style="display: flex;justify-content: space-between;">
 				        <span>特征值</span>
+						<el-button type="primary" plain size="small" @click="showOnlyCurve">只显示曲线</el-button>
 						<el-button type="primary" plain size="small" @click="saveFeature">计算并保存</el-button>
+						<el-button type="primary" plain size="small" @click="saveAsTemp">设为模板</el-button>
 				    </div>
 					
 				</template>
@@ -29,7 +31,7 @@
 				        <div style="width:40px;">序号</div>
 						<div style="flex:1;text-align: center;">位移</div>
 						<div style="flex:1;text-align: center;">载荷</div>
-						<el-button type="primary" plain size="small" @click="startDiagnose">诊断</el-button>
+						<el-button type="primary" plain size="small" @click="buildChart">诊断</el-button>
 				    </div>
 					
 					
@@ -202,6 +204,29 @@
 		})
 	}
 	
+	const showOnlyCurve=()=>{
+		featureDiagram.value.showOnlyCurve()
+	}
+	
+	
+	
+	const buildChart=()=>{
+		let param={}
+		param.wellId=queryForm.wellId
+		param.diagramTime=crtDrawDatas.serial.smpTime
+		diagnoseStandardAPI.startDiagnose(param).then(resp=>{
+			console.log(resp)
+			if(resp.code!=0){
+				ElMessage.error(resp.msg)
+				return
+			}
+			ElMessage.success(resp.data.conclusion)
+		})
+		.catch(err=>{
+			console.log(err)
+		})
+	}
+	
 	const saveFeature=()=>{
 		let saveData={}
 		Object.assign(saveData,featureParams)
@@ -218,6 +243,39 @@
 		})
 	}
 	
+	const saveAsTemp=()=>{
+		ElMessageBox.prompt('创建功图模板',null,{
+		   		   showCancelButton:true,
+		   		   showInput:true,
+				   inputType:'text',
+				   inputValue:null,
+				   inputPlaceholder:'请输入诊断结论',
+				   inputPattern:/\S+/,
+				   inputErrorMessage:'诊断结论不能为空',
+				   closeOnClickModal:false
+				}).then(({value })=>{
+					let saveData={conclusion:value}
+					saveData.wellId=queryForm.wellId
+					saveData.diagramTime=crtDrawDatas.serial.smpTime
+					diagnoseStandardAPI.convert2TempDiagram(saveData).then(resp=>{
+						console.log(resp)
+						if(resp.code!=0){
+							ElMessage.error(resp.msg)
+							return
+						}
+						ElMessage.success('操作成功')
+					}).catch(err=>{
+						console.log(err)
+					})
+					
+				})
+				.catch(err => {
+					console.log('cancel save as '+err)
+				})
+				
+		
+	}
+	
 	const startDiagnose=()=>{
 		let reqData={}
 		reqData.wellId=queryForm.wellId