Forráskód Böngészése

单值单参数历史数据中增加校正数据功能

chenwen 5 hónapja
szülő
commit
c39f5c27e4
2 módosított fájl, 44 hozzáadás és 1 törlés
  1. 8 0
      src/api/wellParam.js
  2. 36 1
      src/pages/single/ParamHisData.vue

+ 8 - 0
src/api/wellParam.js

@@ -56,4 +56,12 @@ api.synGather = (wellId)=>{
 	});
 }
 
+api.updateGatherVal = (wellParam,gatherTime,gatherVal)=>{
+	return request({
+	    url: '/paramdata/updateGatherVal',
+		method: 'post',
+	    data:  {wellParam,gatherTime,gatherVal}
+	});
+}
+
 export  default api

+ 36 - 1
src/pages/single/ParamHisData.vue

@@ -32,7 +32,12 @@
 		  		<el-table-column fixed type="index" :index="indexGenerate" label="序号" width="60" align="center"/>
 		  		<el-table-column prop="gatherTime" label="采集时间" width="180" />
 		  		<el-table-column prop="dispDataVal" :label="paramClmLab" width="160" />
-				<el-table-column prop="alarmDesc" label="报警" width="300" />		
+				<el-table-column prop="alarmDesc" label="报警" width="300" />
+				<el-table-column prop="oper" label="操作" width="120" fixed="right" align="center">
+					<template #default="scope">
+						<el-button type="success" icon="edit" size="small" @click="adjustVal(scope.row)">校正数值</el-button>
+					</template>
+				</el-table-column>
 		  </template>
 		</CrudTable>
 	</div>
@@ -68,6 +73,36 @@
 		})
 	}
 	
+	const adjustVal=(row)=>{
+		ElMessageBox.prompt('请输入校正后的数值', '校正数值', {
+		    confirmButtonText: '确定',
+		    cancelButtonText: '取消',
+		    inputPattern:/^\d+(\.\d+)?$/,
+		    inputErrorMessage: '校正后应为数值',
+			draggable:true,
+			closeOnClickModal:false,
+			inputValue:row.dispDataVal
+		  }).then(({value} )=>{
+			 submitAdjustVal(row,value)
+		  }).catch(()=>{
+			  console.log('cancel')
+		  })
+	}
+	
+	const submitAdjustVal=(row,gatherVal)=>{
+		let {wellParam,gatherTime}=row
+		wellParamAPI.updateGatherVal(wellParam,gatherTime,gatherVal).then(resp=>{
+			if(resp.code!=0){
+				ElMessage.error(resp.msg || '校正数据失败')
+				return
+			}
+			ElMessage.success('操作成功')
+			crudTable.value.refresh()
+		}).catch(err=>{
+			ElMessage.error(err||'校正数据出错')
+		})
+	}
+	
 	const dialogH=(document.body.clientHeight-350)+'px'
 	
 	onMounted(()=>{